From c6c0723e27201672409e18a682b54a2fa08015d8 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Thu, 7 Dec 2023 23:49:19 +0100 Subject: [PATCH] Renamed config command to service, make auth a subcommand --- cmd/add.go | 2 +- cmd/auth.go | 3 +-- cmd/{config.go => service.go} | 13 ++++++------- 3 files changed, 8 insertions(+), 10 deletions(-) rename cmd/{config.go => service.go} (83%) diff --git a/cmd/add.go b/cmd/add.go index 0d0bc8c..ab2f4fb 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -80,7 +80,7 @@ var addCmd = &cobra.Command{ } func init() { - configCmd.AddCommand(addCmd) + serviceCmd.AddCommand(addCmd) // Here you will define your flags and configuration settings. diff --git a/cmd/auth.go b/cmd/auth.go index c0a1129..70f4f81 100644 --- a/cmd/auth.go +++ b/cmd/auth.go @@ -33,7 +33,6 @@ import ( "golang.org/x/oauth2" ) -// authCmd represents the auth command var authCmd = &cobra.Command{ Use: "auth", Short: "Authenticate with a backend", @@ -92,7 +91,7 @@ var authCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(authCmd) + serviceCmd.AddCommand(authCmd) authCmd.Flags().StringP("service", "s", "", "Service configuration (required)") authCmd.MarkFlagRequired("service") diff --git a/cmd/config.go b/cmd/service.go similarity index 83% rename from cmd/config.go rename to cmd/service.go index ced8585..7fba51e 100644 --- a/cmd/config.go +++ b/cmd/service.go @@ -25,24 +25,23 @@ import ( "github.com/spf13/cobra" ) -// configCmd represents the config command -var configCmd = &cobra.Command{ - Use: "config", - Short: "Manage the configuration", +var serviceCmd = &cobra.Command{ + Use: "service", + Short: "Manage the service configuration", Long: `Manage the scotty configuration using the subcommands to add, remove or edit services.`, } func init() { - rootCmd.AddCommand(configCmd) + rootCmd.AddCommand(serviceCmd) // Here you will define your flags and configuration settings. // Cobra supports Persistent Flags which will work for this command // and all subcommands, e.g.: - // configCmd.PersistentFlags().String("foo", "", "A help for foo") + // serviceCmd.PersistentFlags().String("foo", "", "A help for foo") // Cobra supports local flags which will only run when this command // is called directly, e.g.: - // configCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + // serviceCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") }