-
-
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
Implemented 'Mandatory flags' per issue #44 #98
Conversation
personally i prefer to leave this portion to the program logic, since it could be more complex, such as if |
@visionmedia maybe a solution for the future is to allow objects on the program
.option({
flags : '-f, --foo <file>',
description : 'Foo option rocks',
required : true,
// specify that this option depends on other ones
depends : '--bar, --ipsum',
validate : function(value, program){
// check if supplied argument is valid
return value.indexOf('.') !== -1;
}
}); this would increase the flexibility and group all the logic related to arguments parsing/validation. |
meh I think that's getting too complex, it's easy to defer most of that to program logic |
Dude, seriously. I expected this feature to be part of commander. Wondering what is the point of commander if not to require arguments? |
don't use it if you dont want to? options are one thing but arguments can be parsed in a nearly infinite number of ways, I'd rather not handle that at all, frankly I want to get rid of sub-command support (as it is now) as well, and go with git-style sub commands |
leaving this up to the user, it's not hard to add a few conditionals |
I don't agree with this position you've taken @visionmedia . It's one of those cases where 99% of the users want the barest most minimal functionality. It's a very ideological stance to take that because things can get more complex no accommodations should be made. That said, I agree with your conclusion -- those that can't live with your decision should go elsewhere. Perhaps though you could make that more apparent in the docs. This is one of three bug reports that references this functionality. I imagine if there was an FAQ it'd be the foremost asked question. Would you accepted a doc-patch that said this feature would not be implemented, with a reference to |
it's trivial to do |
Implemented 'Mandatory flags' based on the thread:
#44.
Similar to the fix from this pull request:
#70, but is additive
and does not break the existing semantics of 'required' arguments.
If this pull request is accepted I'll also update the docs : )