Merge pull request #153 from codegangsta/allow-hiding-of-help-flag

Allow hiding of help flag without hiding help subcommand
This commit is contained in:
2015-01-08 14:49:36 -05:00
4 changed files with 26 additions and 3 deletions

8
app.go
View File

@@ -94,7 +94,9 @@ func (a *App) Run(arguments []string) error {
// append help to commands
if a.Command(helpCommand.Name) == nil && !a.HideHelp {
a.Commands = append(a.Commands, helpCommand)
a.appendFlag(HelpFlag)
if (HelpFlag != BoolFlag{}) {
a.appendFlag(HelpFlag)
}
}
//append version/help flags
@@ -174,7 +176,9 @@ func (a *App) RunAsSubcommand(ctx *Context) error {
if len(a.Commands) > 0 {
if a.Command(helpCommand.Name) == nil && !a.HideHelp {
a.Commands = append(a.Commands, helpCommand)
a.appendFlag(HelpFlag)
if (HelpFlag != BoolFlag{}) {
a.appendFlag(HelpFlag)
}
}
}