-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove [command [command options]] from help text if there are no sub commands #1921
Comments
@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 |
FYI for whoever, the work-around for the time being: override with |
@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 |
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 |
From my understanding, when I check the help template, the text {{if .Commands}} command [command options]{{end}} When I print a command help, I get always the
If we could just disable it, the problem would be solved, no? {{if .CommandsWithoutHelp}} command [command options]{{end}} |
Note that as quick fix for a leaf command, the |
Similarly, if you incorrectly type a command, the generated help for the invalid command has the extra "command" suggestion, whereas the base help does not (correctly). Examples:
However, this shows the extra (wrong) "command" text.
|
@deregtd Would you like to test the PR and report back ? |
Ah unfortunately I haven't moved to v3 yet, so I can't. :( |
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:
Note that
cmd2
has no sub-commands which makes it distracting from reading and understanding theUSAGE
. So what I'd love to instead see is:The text was updated successfully, but these errors were encountered: