You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var containerCmd = &cobra.Command{
Use: "container",
Short: "Global settings for running containers",
}
func init() {
configCmd.AddCommand(containerCmd)
containerCmd.PersistentFlags().String("networkEndpoint", "", "Specify a network endpoint (in case you need to network between containers)")
viper.BindPFlag("networkEndpoint", containerCmd.PersistentFlags().Lookup("networkEndpoint"))
}
...
It only shows the usage when it's added to the rootCmd. When it is not, it only shows the short description. It won't show the help even if I pass the --help flag. It should show the usage when I pass the help flag or no arguments.
I noticed two things:
Cobra returns "help requested" if the command is not runnable
I have a subcommand that has no Run function.
It only shows the usage when it's added to the rootCmd. When it is not, it only shows the short description. It won't show the help even if I pass the
--help flag
. It should show the usage when I pass the help flag or no arguments.I noticed two things:
cobra/command.go
Lines 724 to 726 in fe5e611
cobra/command.go
Lines 432 to 434 in fe5e611
I added
HasFlags
to this template and it always displays the usage.It might be related to #206 (comment)
The text was updated successfully, but these errors were encountered: