Merge pull request #1565 from remiposo/avoid_duplication_of_help_commands

Fix: Avoid duplication of help commands
This commit is contained in:
dearchap 2022-11-04 08:12:41 -04:00 committed by GitHub
commit e194a18542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,7 +246,7 @@ func ShowCommandHelp(ctx *Context, command string) error {
}
for _, c := range commands {
if c.HasName(command) {
if !ctx.App.HideHelpCommand && !c.HasName(helpName) && len(c.Subcommands) != 0 {
if !ctx.App.HideHelpCommand && !c.HasName(helpName) && len(c.Subcommands) != 0 && c.Command(helpName) == nil {
c.Subcommands = append(c.Subcommands, helpCommandDontUse)
}
if !ctx.App.HideHelp && HelpFlag != nil {