cobra
cobra copied to clipboard
Override help subcommand logic
I am using cobra. I don't need subcommands. I do want the default help and completion subcommands to be generated. There should be an option for "generate default subcommands even if no other subcommands are defined".
func (c *Command) InitDefaultHelpCmd() {
if !c.HasSubCommands() {
return
}
// ...
}
There should be some option that disables the subcommand check.
#1559 does this for the completion command.
How would the help command be used in such a case though? The help command is usually used as program help subcommand
I use program help
all the time to print the usage message. Sure, I could use program --help
, but it's muscle memory at this point.