-
-
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
"name" option is broken as of 2.4.0 #284
Comments
Nope, you're not wrong, it's a problem and it will be fixed. Closed as dupe of #283 |
Oh whoops, didn't see that! On Monday, October 27, 2014, Thomas Geraghty [email protected]
|
@thethomaseffect Because How do u guys think about this? @tonylukasavage @thethomaseffect @SomeKittens |
@zhiyelee Your fix seems like the best option, though changing the public API without a major version increment is unfortunate |
@zhiyelee I wouldn't change the API. It is what people have come to expect and works well in most cases. I already handle this situation, post Object.keys(program.opts()).forEach(function(opt) {
if (Object.prototype.toString.call(program[opt]) === '[object Function]') {
delete program[opt];
}
}); This removes any option that is an function, hence making |
What about adding an API method that allows you to get the value of an argument by name? e.g., something like: cmd.get('name'); Where |
Though, TBH, I think this bug should still be fixed properly in the future, whether that means a major version or not. |
I think the best way to solve this is to advise people to use The advantages of this approach are:
So no breaking the public API and we get to address other bugs too before our next major version. Thoughts? |
Sounds reasonable to me! :) I actually didn't know I could use |
It was only added in a recent release and it's undocumented right now mostly due to not getting the amount of testing it deserves from the collaborators. :) |
Similar to #105, closed, keep your eyes on the issue. |
One of my command line flags is called '--name', but as of bfa7a73, if the name option is left off,
cmd.name
is a function. I suppose this is indicative of a larger problem, i.e., options are stored on top-level namespace of the command object.e.g., say you have this file, mycmd.js
you will see the following output:
Thoughts?
Is this wrong, or am I missing something?
The text was updated successfully, but these errors were encountered: