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

Correctly show help message if `-h` is provided to subcommand
main
Dan Buch 8 years ago committed by GitHub
commit f4ee034378

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

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

Loading…
Cancel
Save