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
+11 -1
View File
@@ -68,6 +68,15 @@ var helpCommand = &Command{
}
// Case 3, 5
if (len(cCtx.Command.Subcommands) == 1 && !cCtx.Command.HideHelp) ||
(len(cCtx.Command.Subcommands) == 0 && cCtx.Command.HideHelp) {
templ := cCtx.Command.CustomHelpTemplate
if templ == "" {
templ = CommandHelpTemplate
}
HelpPrinter(cCtx.App.Writer, templ, cCtx.Command)
return nil
}
return ShowSubcommandHelp(cCtx)
},
}
@@ -230,8 +239,9 @@ func ShowCommandHelpAndExit(c *Context, command string, code int) {
// ShowCommandHelp prints help for the given command
func ShowCommandHelp(ctx *Context, command string) error {
commands := ctx.App.Commands
if ctx.Command != nil {
if ctx.Command.Subcommands != nil {
commands = ctx.Command.Subcommands
}
for _, c := range commands {