-
-
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
Throw an error when the short flag for an option for longer than one character #937
Comments
The documentation does mention the cli behaviour:
but I agree it would be nice if commander warned you about the setup problem. |
It does mention that, but it took me a long time to put two and two together. I.e.: It does take some thinking to realise that a two character flag cannot work due to the short flag feature. It doesn't explicitly say so in the documentation. I think an addition to the documentation, and an error or warning given when the misleading setup is actioned would be suitable. |
It now explicitly says single character in the documentation. (But still no warning about coding error, so feel free to keep this issue open.) |
Some more errors or warnings for coders (rather than users) is something we can improve in future. Closing this as have made an improvement with the addition to the README. |
In the
.option(...)
method, it takes a string flag which is comma separated, and describes a short and a long flag for passing arguments, such as:However, when given a short flag which is longer than one character, the program will still parse and execute, but cannot be accessed by its short flag.
For example:
It is impossible to use
-nv
on the command-line, as commander interprets this as two short flags concatenated together:-n
and-v
.It would be better to throw an error to avoid the misleading set up of commander options.
The text was updated successfully, but these errors were encountered: