Merge pull request #481 from urfave/fix-subcommand-help-flag

Correctly show help message if `-h` is provided to subcommand
This commit is contained in:
Dan Buch 2016-07-14 16:00:57 -04:00 committed by GitHub
commit f4ee034378
2 changed files with 2 additions and 1 deletions

View File

@ -908,6 +908,7 @@ func TestApp_Run_CommandWithSubcommandHasHelpTopic(t *testing.T) {
Name: "foo",
Description: "descriptive wall of text about how it does foo things",
Subcommands: []Command{subCmdBar, subCmdBaz},
Action: func(c *Context) error { return nil },
}
app.Commands = []Command{cmd}

View File

@ -240,7 +240,7 @@ func checkCommandHelp(c *Context, name string) bool {
}
func checkSubcommandHelp(c *Context) bool {
if c.GlobalBool("h") || c.GlobalBool("help") {
if c.Bool("h") || c.Bool("help") {
ShowSubcommandHelp(c)
return true
}