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
@ -582,7 +582,7 @@ func (c *Command) Execute() (err error) {
|
|||||||
err = cmd.execute(flags)
|
err = cmd.execute(flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == flag.ErrHelp {
|
if err == flag.ErrHelp {
|
||||||
cmd.Help()
|
cmd.HelpFunc()(cmd, args)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
c.Println(cmd.UsageString())
|
c.Println(cmd.UsageString())
|
||||||
|
Loading…
Reference in New Issue
Block a user