-
-
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
Can not use action as option name #1020
Comments
The option values are added as properties on a Command object. This can conflict with properties which are already part of a Command, like in the case of an This was a tradeoff in the original design. The work-around is to use a different option name. The reference open bug is #183, and |
I'm working on react related project and I have to use |
Great. For now I used |
I have opened a Pull Request which allows storing option values separately rather than as command properties (access using See #1102 |
Added See: https://github.com/tj/commander.js#avoiding-option-name-clashes |
Hi,
Consider following code:
When I call it like this:
command NAME -a
, the output will be:But when I call it like this:
command NAME -a -a
, the output will be:Now if I change
.option("-a, --action", "Action")
to.option("-a, --action_", "Action")
andconsole.log(
action: ${options.action});
toconsole.log(
action: ${options.action_});
and call it like thiscommand NAME -a
, the output will be:The text was updated successfully, but these errors were encountered: