Refactor routes cmd
This commit is contained in:
parent
e56755fd67
commit
d87a4c87cc
1 changed files with 10 additions and 3 deletions
|
@ -8,12 +8,19 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var RoutesCmd = &cobra.Command{
|
func init() {
|
||||||
|
rootCmd.AddCommand(routesCmd)
|
||||||
|
routesCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
||||||
|
routesCmd.AddCommand(listRoutesCmd)
|
||||||
|
routesCmd.AddCommand(enableRouteCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
var routesCmd = &cobra.Command{
|
||||||
Use: "routes",
|
Use: "routes",
|
||||||
Short: "Manage the routes of Headscale",
|
Short: "Manage the routes of Headscale",
|
||||||
}
|
}
|
||||||
|
|
||||||
var ListRoutesCmd = &cobra.Command{
|
var listRoutesCmd = &cobra.Command{
|
||||||
Use: "list NODE",
|
Use: "list NODE",
|
||||||
Short: "List the routes exposed by this node",
|
Short: "List the routes exposed by this node",
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
|
@ -49,7 +56,7 @@ var ListRoutesCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var EnableRouteCmd = &cobra.Command{
|
var enableRouteCmd = &cobra.Command{
|
||||||
Use: "enable node-name route",
|
Use: "enable node-name route",
|
||||||
Short: "Allows exposing a route declared by this node to the rest of the nodes",
|
Short: "Allows exposing a route declared by this node to the rest of the nodes",
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|
Loading…
Reference in a new issue