-
-
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
'version' is interpreted as '--version' #471
Comments
Does the bug still happen if you put |
Yup
But that really does not come as a surprise, as the shell does the unescaping. I can escape the quotes, as in |
Yup, definitely a bug on our side. |
I looked at the source, and it happens due to the logic in parseOptions and parseArgs that does away with the dashes, and subsequently "--version" and "version" both emits the same signal. Not totally sure how to fix this in a nice way. |
Maybe Whatever the solution might be, "--version" and "version" should result in two different event names. |
… Added tests for shell commands.
According to the docs, only "my-cmd --version" should output the version number, but I have found that commander also picks up the string 'version' anywhere in the arguments.
As an example of where this causes problems, you can have a look at a little utility I wrote called pick_json. It is used it to extract fields from json on stdin.
As you can see, instead of picking the version field from the json, it shows the version number of
pick_json
. This is not inline with the docs.The text was updated successfully, but these errors were encountered: