From 00ca963c2633afe5679c5b3c67683bd113f2720a Mon Sep 17 00:00:00 2001 From: Magnus Landerblom Date: Wed, 26 Nov 2025 08:05:26 +0100 Subject: [PATCH] Dont print usage twice --- cmd/instance_account.go | 1 + cmd/instance_actions.go | 1 + cmd/instance_config.go | 1 + cmd/instance_manage.go | 4 ++++ cmd/instance_nodes.go | 1 + cmd/instance_plugins.go | 1 + 6 files changed, 9 insertions(+) diff --git a/cmd/instance_account.go b/cmd/instance_account.go index 93f408c..1536fd6 100644 --- a/cmd/instance_account.go +++ b/cmd/instance_account.go @@ -13,6 +13,7 @@ var instanceAccountCmd = &cobra.Command{ Long: `Rotate password and API key for the instance.`, RunE: func(cmd *cobra.Command, args []string) error { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand required") }, } diff --git a/cmd/instance_actions.go b/cmd/instance_actions.go index a18ac94..65dc363 100644 --- a/cmd/instance_actions.go +++ b/cmd/instance_actions.go @@ -15,6 +15,7 @@ var instanceActionsCmd = &cobra.Command{ Long: `Restart, stop, start, reboot, and upgrade instance components.`, RunE: func(cmd *cobra.Command, args []string) error { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand required") }, } diff --git a/cmd/instance_config.go b/cmd/instance_config.go index 0465cae..31cac48 100644 --- a/cmd/instance_config.go +++ b/cmd/instance_config.go @@ -15,6 +15,7 @@ var instanceConfigCmd = &cobra.Command{ Long: `Get and update RabbitMQ configuration settings for the instance.`, RunE: func(cmd *cobra.Command, args []string) error { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand required") }, } diff --git a/cmd/instance_manage.go b/cmd/instance_manage.go index b507d1c..2b30173 100644 --- a/cmd/instance_manage.go +++ b/cmd/instance_manage.go @@ -19,11 +19,13 @@ Instance API keys are automatically saved when you run 'cloudamqp instance get < RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("instance ID is required") } if len(args) == 1 { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand is required") } @@ -63,6 +65,7 @@ Instance API keys are automatically saved when you run 'cloudamqp instance get < // If no RunE, show help for the subcommand if len(subCmd.Commands()) > 0 { subCmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand required for %s", subcommandName) } @@ -71,6 +74,7 @@ Instance API keys are automatically saved when you run 'cloudamqp instance get < } cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("unknown subcommand: %s", subcommandName) }, } diff --git a/cmd/instance_nodes.go b/cmd/instance_nodes.go index 3cc20bb..6777f91 100644 --- a/cmd/instance_nodes.go +++ b/cmd/instance_nodes.go @@ -15,6 +15,7 @@ var instanceNodesCmd = &cobra.Command{ Long: `List nodes and get available versions for the instance.`, RunE: func(cmd *cobra.Command, args []string) error { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand required") }, } diff --git a/cmd/instance_plugins.go b/cmd/instance_plugins.go index 0fd2db2..47b2347 100644 --- a/cmd/instance_plugins.go +++ b/cmd/instance_plugins.go @@ -15,6 +15,7 @@ var instancePluginsCmd = &cobra.Command{ Long: `List, enable, and disable RabbitMQ plugins for the instance.`, RunE: func(cmd *cobra.Command, args []string) error { cmd.Help() + cmd.SilenceUsage = true return fmt.Errorf("subcommand required") }, }