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
Add support for -v to get the version #560
Comments
@tj, why was this change made? I tried to track down why that change was made, but I couldn’t find anything. 😕 |
I've always been really curious about this as well. I've been using this quick fix near the top of my CLI app to ensure var vPos = process.argv.indexOf('-v')
if (vPos > -1) {
process.argv[vPos] = '-V'
} |
Probably because several tools use -v and --verbose for their verbose output flag and -V and --version for their version flag |
Thanks @jrylan, that does the trick. But only if you are okay with the auto-generated help not mentioning |
@sgen But nearly the whole environment around
It should at least be configurable. Maybe directly on the version command, like: cli.version('1.0.0', '-v, --version'); |
I prefer -V for verbose. Also, is there an easy way to replace -V with -v? If I add a new option, it will show both. Maybe I'm missing something. |
This is already possible. It's just a customization:
If the flags aren't specified, they just default to One pattern I happen to like is to honor the |
I think the API docs need to be updated to reflect the fact that flags can be specified as an override. |
Tried to look for a way to add that doc, couldn't. Thanks @mojavelinux for the tip. |
Wrote this instead. |
As it turns out, the flag can be overridden, but the program continues to respond only to a long name that resolves to "version". But this makes the help inaccurate. I'll submit a patch to respect the name of the option specified in the method. |
Patches submitted! |
Seems to work just fine on my end without the patch? What am I missing? |
@ahmadawais You are using the default name for the option, which is version. If you wanted to use a different name, like |
Got it. |
resolves #560 respect custom name for version option
Please add support for
-v
instead of-V
to get the--version
to be consistent with Node and npm (and a lot of other CLIs).Related to #509
The text was updated successfully, but these errors were encountered: