Skip to content
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

Cannot name options/subcommands after commander public methods or JavaScript built-ins #19

Closed
dobesv opened this issue Oct 9, 2011 · 6 comments

Comments

@dobesv
Copy link

dobesv commented Oct 9, 2011

I tried to create a parameter with the long name 'password' and it didn't work out well, since that conflicts with the method password(). Same would go for 'action', 'option', and so on. Perhaps the parsed options could come back in a separate object? Or be able to assign an alias to those option names?

Workaround currently is to use a different long name so that it doesn't conflict with those.

@tj
Copy link
Owner

tj commented Oct 9, 2011

good point haha. perhaps we should have them as program.<prop> by default but also have program.options.<prop> or similar for cases like these

@dobesv
Copy link
Author

dobesv commented Nov 5, 2011

To clarify the issue a bit more:

Using an option named 'prompt' or 'password' means that:

  1. if the user supplies the option, you can't use that method afterwards because it is replaced with a string value from the user.
  2. if you want to check if the option was provided (using 'password' in program or program.password != null), it always returns true

@tj
Copy link
Owner

tj commented Nov 5, 2011

yeah i know, there's no compromise really, we have to either place the option values somewhere else, or rename the methods

@itay
Copy link
Contributor

itay commented Nov 23, 2011

My vote is to place the options in program.options - I think it makes it much clearer.

@thethomaseffect thethomaseffect changed the title Cannot use parameter names named after commander methods Cannot name options/subcommands after commander public methods or JavaScript built-ins Oct 29, 2014
@thethomaseffect
Copy link
Collaborator

Changed title of issue to better cover the scope of this problem. program.opts is now available but this is still causing a number of issues for users. using program.option with be depreciated in favor of program.opts.option in a later release unless someone comes up with a better way to handle this issue.

@roman-vanesyan
Copy link
Collaborator

roman-vanesyan commented Jun 16, 2017

Closed, outdated. Feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants