-
-
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
Allow optional values (not simply optional args with value notation) #892
Comments
Try setting Let me know if that doesn't work 😉 |
Thanks so so much bunch, @kbknapp! :) EDIT: haha "so so much bunch"... |
It would be great if a brief note about this use case could be added to Also, in this use case the difference between
Because it seem to suggest that it returns if matches.is_present("bump") {
if let Some(v) = matches.value_of("bump") {
println!("bump == {:?}", v);
} else {
println!("bump"); // matters only under `min_values(0)`
}
} else {
println!("do not bump");
} |
@nodakai I'd be good adding that blurb or updating the docs if you could open a new issue for it. Could you point out a link to the sections which should be made more clear? I have the problem of guilty knowledge and it's hard to for me to see which parts aren't exactly clear since I wrote the library and am intimately familiar with it 😜 |
From my reading of the docs, this isn't possible, but feel free to correct me!
The distinction being that an optional argument using value notation is currently possible
Which would allow all of:
But I don't think there's a way to allow an optional value, like so:
Any help or guidance is appreciated! If this is already possible, I'm happy to help update the docs to better convey this distinction :)
The text was updated successfully, but these errors were encountered: