Merge latest and fix tests

This commit is contained in:
Naveen Gogineni
2022-09-24 21:07:00 -04:00
parent d5947d7814
commit bc9ae33465
4 changed files with 22 additions and 16 deletions

View File

@@ -109,19 +109,14 @@ func (cmd *Command) Command(name string) *Command {
}
func (c *Command) setup(ctx *Context) {
helpCmd := helpCommand
if len(c.Subcommands) > 0 {
helpCmd = helpSubcommand
}
if c.Command(helpCmd.Name) == nil && !c.HideHelp {
if c.Command(helpCommand.Name) == nil && !c.HideHelp {
if !c.HideHelpCommand {
c.Subcommands = append(c.Subcommands, helpCmd)
c.Subcommands = append(c.Subcommands, helpCommand)
}
}
if c.helpAction == nil {
c.helpAction = helpCmd.Action
c.helpAction = helpCommand.Action
}
if !c.HideHelp && HelpFlag != nil {
@@ -183,7 +178,7 @@ func (c *Command) Run(cCtx *Context, arguments []string) (err error) {
if c.isRoot {
_ = ShowAppHelp(cCtx)
} else {
_ = ShowCommandHelp(cCtx, c.Name)
_ = ShowCommandHelp(cCtx.parentContext, c.Name)
}
}
return err