-
Notifications
You must be signed in to change notification settings - Fork 478
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
Specifying that an Option requires another Option #3
Comments
Comment by st1led Thank you for your support, I'll try to reformulate the question in a clearer way. I would like to know if CommandLine offers some API for a behavior like the following one:
Note that in this example I defined option To achieve this behavior, I have to manually write some code in my program to check if arguments have been correctly set. Since I can't find any way to do it in CommandLine, I'm asking if such feature exists, or is planned for future versions and if not... Would it be a good idea for future CommandLine versions? To me having dependencies between arguments sounds like a pretty common scenario. Regards, |
Comment by nemec I think that it's a good idea. I'm not sure what kind of syntax you were going for with A couple potential issues: What if the option you depend on doesn't have a long option? If an option defines both a short and long option, which do you use? |
Comment by st1led The syntax was just an attempt to specify an array of identifiers representing the options (just Since an Option can specify either a long or a short name, there would be the need to add a new parameter (named I guess Regards, |
Comment by nemec I'm inclined to recommend using the property name itself (e.g. |
Comment by st1led Using the property name sounds like a brilliant idea to me. This way the Regards, |
Comment by nemec If only delegates were allowed as arguments to an attribute... you could do so much with strong typing.
|
Comment by shengqh Is there any news about this feature? I met such problem too. |
Comment by Mizipzor To me it makes more sense allowing a time-limit to be set, even if the optional-operation is not set. The time limit would then just be ignored by the program. And if you want to enforce this dependency it's a trivial check to do after parsing. I don't think the increased parsing complexity is worth it to provide this functionality built in. Can we find some other program that behaves this way, with argument dependencies? |
So... how do we do this? I can't see anything in the wiki that indicates that this feature is available. |
Why is this issue closed? Is there anyway to do it now that is not documented? |
Issue by st1led
Tuesday Apr 09, 2013 at 09:55 GMT
Originally opened as gsscoder/commandline#76
Hi everybody, is there a way in CommandLine (I guess in a way similar to what is done with mutually exclusive properties) to specify that an option requires another option to be set? This is a short example:
In this scenario, one would want to allow command line arguments like
-o
and-vot
but not-vt
or-t
for instance, since in the latter the option-t
is specified without-o
. Is this currently possible in CommandLine?Regards,
Stefano
The text was updated successfully, but these errors were encountered: