From d87a4c87cc6cf926dbe154da7f904b365ba43cf6 Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Sun, 25 Jul 2021 15:08:40 +0200 Subject: [PATCH] Refactor routes cmd --- cmd/headscale/cli/routes.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/headscale/cli/routes.go b/cmd/headscale/cli/routes.go index 007bc6c2..aa392818 100644 --- a/cmd/headscale/cli/routes.go +++ b/cmd/headscale/cli/routes.go @@ -8,12 +8,19 @@ import ( "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", Short: "Manage the routes of Headscale", } -var ListRoutesCmd = &cobra.Command{ +var listRoutesCmd = &cobra.Command{ Use: "list NODE", Short: "List the routes exposed by this node", 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", Short: "Allows exposing a route declared by this node to the rest of the nodes", Args: func(cmd *cobra.Command, args []string) error {