Skip to content

Commit 0d14e52

Browse files
authored
Don't print usage twice (#17)
1 parent 285bd2b commit 0d14e52

6 files changed

Lines changed: 9 additions & 0 deletions

File tree

cmd/instance_account.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var instanceAccountCmd = &cobra.Command{
1313
Long: `Rotate password and API key for the instance.`,
1414
RunE: func(cmd *cobra.Command, args []string) error {
1515
cmd.Help()
16+
cmd.SilenceUsage = true
1617
return fmt.Errorf("subcommand required")
1718
},
1819
}

cmd/instance_actions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var instanceActionsCmd = &cobra.Command{
1515
Long: `Restart, stop, start, reboot, and upgrade instance components.`,
1616
RunE: func(cmd *cobra.Command, args []string) error {
1717
cmd.Help()
18+
cmd.SilenceUsage = true
1819
return fmt.Errorf("subcommand required")
1920
},
2021
}

cmd/instance_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var instanceConfigCmd = &cobra.Command{
1515
Long: `Get and update RabbitMQ configuration settings for the instance.`,
1616
RunE: func(cmd *cobra.Command, args []string) error {
1717
cmd.Help()
18+
cmd.SilenceUsage = true
1819
return fmt.Errorf("subcommand required")
1920
},
2021
}

cmd/instance_manage.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ Instance API keys are automatically saved when you run 'cloudamqp instance get <
1919
RunE: func(cmd *cobra.Command, args []string) error {
2020
if len(args) == 0 {
2121
cmd.Help()
22+
cmd.SilenceUsage = true
2223
return fmt.Errorf("instance ID is required")
2324
}
2425

2526
if len(args) == 1 {
2627
cmd.Help()
28+
cmd.SilenceUsage = true
2729
return fmt.Errorf("subcommand is required")
2830
}
2931

@@ -63,6 +65,7 @@ Instance API keys are automatically saved when you run 'cloudamqp instance get <
6365
// If no RunE, show help for the subcommand
6466
if len(subCmd.Commands()) > 0 {
6567
subCmd.Help()
68+
cmd.SilenceUsage = true
6669
return fmt.Errorf("subcommand required for %s", subcommandName)
6770
}
6871

@@ -71,6 +74,7 @@ Instance API keys are automatically saved when you run 'cloudamqp instance get <
7174
}
7275

7376
cmd.Help()
77+
cmd.SilenceUsage = true
7478
return fmt.Errorf("unknown subcommand: %s", subcommandName)
7579
},
7680
}

cmd/instance_nodes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var instanceNodesCmd = &cobra.Command{
1515
Long: `List nodes and get available versions for the instance.`,
1616
RunE: func(cmd *cobra.Command, args []string) error {
1717
cmd.Help()
18+
cmd.SilenceUsage = true
1819
return fmt.Errorf("subcommand required")
1920
},
2021
}

cmd/instance_plugins.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var instancePluginsCmd = &cobra.Command{
1515
Long: `List, enable, and disable RabbitMQ plugins for the instance.`,
1616
RunE: func(cmd *cobra.Command, args []string) error {
1717
cmd.Help()
18+
cmd.SilenceUsage = true
1819
return fmt.Errorf("subcommand required")
1920
},
2021
}

0 commit comments

Comments
 (0)