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:
Eric Paris 2015-09-01 14:10:55 -04:00
parent 27bf24802c
commit c2d19e9c43

View file

@ -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())