move helpverb default higher in the execute stack

This commit is contained in:
Chase Hutchins 2019-01-24 13:56:59 -07:00
parent 191297c568
commit 64bd4318af

View file

@ -684,11 +684,6 @@ func (c *Command) execute(a []string) (err error) {
c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated) c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated)
} }
// Set the help verb to "help" if a custom word is not defined.
if len(c.HelpVerb) == 0 {
c.HelpVerb = "help"
}
// initialize help and version flag at the last point possible to allow for user // initialize help and version flag at the last point possible to allow for user
// overriding // overriding
c.InitDefaultHelpFlag() c.InitDefaultHelpFlag()
@ -821,6 +816,11 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
preExecHookFn(c) preExecHookFn(c)
} }
// Set the help verb to "help" if a custom word is not defined.
if len(c.HelpVerb) == 0 {
c.HelpVerb = "help"
}
// initialize help as the last point possible to allow for user // initialize help as the last point possible to allow for user
// overriding // overriding
c.InitDefaultHelpCmd() c.InitDefaultHelpCmd()