Remove [command [command options]] from help text if there are no sub commands
marwan-at-work opened this issue · comments
Hi there,
I think it would help readability a lot if cli/v3 can check for subcommands first before printing the help of a command.
For example, right now this is the help that I get:
NAME:
app cmd1 cmd2 - does something cool
USAGE:
app cmd1 cmd2 [command [command options]] <myArgUsage>
OPTIONS:
--flag value (default: 1)
--help, -h show help (default: false)
Note that cmd2
has no sub-commands which makes it distracting from reading and understanding the USAGE
. So what I'd love to instead see is:
NAME:
app cmd1 cmd2 - does something cool
USAGE:
app cmd1 cmd2 <myArgUsage>
OPTIONS:
--flag value (default: 1)
--help, -h show help (default: false)
@marwan-at-work want to make a PR for me to review for this ?
Noticed this as well, thanks for raising @marwan-at-work. In app cmd1 cmd2 <myArgUsage>
what do you expect if your cmd1
/cmd2
accepts options? Does it then need to be something along the lines of app cmd1 cmd2 [command options] <myArgUsage>
? I'm not sure.
FYI for whoever, the work-around for the time being: override with UsageText
.
@dearchap I'm interested in working on this. Do you have any ideas on how we can address this? The help command gets added as a subcommand so we can't simply check for Commands != nil
.
You could probably add a helper function in Command to list number of non help commands. That function needs to be exported for use in the template