mirror of
https://github.com/spf13/cobra
synced 2024-12-28 23:37:09 +00:00
Use the HelpFunc for the --help flag
We were just calling Help() when a user set the --help flag. You could overwrite how the help subcommand worked with SetHelpFunc, but not now the --help flag worked.
This commit is contained in:
parent
27bf24802c
commit
c2d19e9c43
1 changed files with 1 additions and 1 deletions
|
@ -582,7 +582,7 @@ func (c *Command) Execute() (err error) {
|
|||
err = cmd.execute(flags)
|
||||
if err != nil {
|
||||
if err == flag.ErrHelp {
|
||||
cmd.Help()
|
||||
cmd.HelpFunc()(cmd, args)
|
||||
return nil
|
||||
}
|
||||
c.Println(cmd.UsageString())
|
||||
|
|
Loading…
Reference in a new issue