-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Question] Dynamic Flags #1089
Comments
This is fine for questions, I welcome them anywhere 😄 What you're looking for is supported as what clap calls options. Minus If you make an option with only a short, it'll work exactly like you're looking for app
.arg(Arg::from_usage("-f [optimization] 'Enables compiler optimizations'"))
.arg(Arg::from_usage("-W [warning] 'Turns a warning off'"))
.arg(Arg::from_usage("-w [warning] 'Turns a warning on'")) Then one could also add a Could be run as Once I get to a computer (I'm on mobile) I can explain the |
Looks really nice. Thank you very much! The last think I need is |
Sorry it took me so long I got home late. Right now, when clap encounters a single hyphen it looks so see if the next character is a flag or an option. If it's a flag, it then looks at the next character to see if it's also a flag, and so on and so forth. As soon as it encounters an option, it looks at the next character and begins parsing the value. In the case of .arg(Arg::from_usage("-f [optimization] 'Enables compiler optimizations (or disables if they start with \'no-\''")) So that's the "workaround" but I understand that may be less than ideal. So I've also been toying with the idea of adding an The downside to using this new setting, it would disable the ability to "stack" flags (such as using |
In fact, I wouldn't want you to change design of this awesome library. Do not worry. I will play with the capital |
It wouldn't be changing the design, that's the purpose of the AppSettings enum, to tweak behavior as an opt in feature 😉 |
Hi!
This is not a issue, but more a question. I'm sorry if I chose the wrong place to ask questions. Is it possible to create dynamic flags, if yes, could you please provide a small example of parsing and using such a flags.
Desired format:
Thus, for example, user will able to use
app
as follows:Note: Here is one
-
and each flag definition provided in regexp form.Thank you
The text was updated successfully, but these errors were encountered: