-
-
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
Main help output doesn't show custom usage
of commands
#1885
Comments
There was a PR recently to show the custom usage in the list of subcommands (#1853). I was concerned the custom help might be long if displaying all the options, and not work well in the list of subcommands. Interestingly, you qualified your description with "When a command only has limited number of options, I want to display all of them in usage, instead of [options]" so would probably work fine for you. You can modify the behaviour yourself to use the custom usage by customising the help: |
On a separate but related note, for your |
Thank you! Now I'm adding I have read EDIT: In my case there is no default command, so global options is more like common options among all commands, so it makes sense to allow them after command name. |
It does not require much code to customise the help to show custom usage, but you have to work out the code. e.g.
Is it worth supporting directly? Like say:
Edit: I'll probably add some examples for now, and keep monitoring. |
Example added in Commander v11.1.0 |
Version:
"commander": "^10.0.1",
There are several cases I'm using the
.usage()
option:When a command only has limited number of options, I want to display all of them in
usage
, instead of[options]
When a command requires
--
before arguments because otherwise commander parses them as optionsIt's working in each command's individual help message, like
But not in the main help
In particular the second case might confuse the users if they don't know
help [command]
will display a different usage.The text was updated successfully, but these errors were encountered: