Skip to content

Commit dbe1ad0

Browse files
committed
app/cli: disable alternate help <command> route from polluting UX
1 parent 0acfdd5 commit dbe1ad0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

app/cli/cobrawrappers.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ func Execute(app *cobra.Command) {
2121
// hide the default "completion" subcommand from polluting UX (it can still be used). https://github.com/spf13/cobra/issues/1507
2222
app.CompletionOptions = cobra.CompletionOptions{HiddenDefaultCmd: true}
2323

24+
// disable alternate `help <command>` route from polluting UX.
25+
// the de facto `--help` can still be used and pro-tip for that is prominently visible.
26+
// https://github.com/spf13/cobra/issues/587#issuecomment-843747825
27+
app.SetHelpCommand(&cobra.Command{Hidden: true})
28+
2429
// cannot `AddLogLevelControls(app.Flags())` here because it gets confusing if:
2530
// a) the root command is not runnable
2631
// b) the root command is runnable BUT it doesn't do logging (or there is no debug-level logs to suppress)

0 commit comments

Comments
 (0)