Merge pull request #286 from dnephin/merge_flags_before_adding_help

Merge persistent flags before checking for a help flag
This commit is contained in:
Eric Paris
2016-10-10 11:14:18 -04:00
committed by GitHub
2 changed files with 16 additions and 0 deletions

View File

@ -735,6 +735,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
}
func (c *Command) initHelpFlag() {
c.mergePersistentFlags()
if c.Flags().Lookup("help") == nil {
c.Flags().BoolP("help", "h", false, "help for "+c.Name())
}