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
Can't use ValueParser to replace PossibleValues in v4 #4351
Comments
For now, |
Just wondering, is it planned to have it back working with other types eventually? (e.g. that implement FromStr?) Chances are, these lines will be copied/pasted many-many times all over the place (it's just one of the most common use cases for the old use clap::builder::{PossibleValuesParser, TypedValueParser as _};
...
value_parser = PossibleValuesParser::new(Foo::VARIANTS)
.map(|s| s.parse::<Foo>().unwrap()) E.g.: value_parser = PossibleValuesFromStr::<Foo>::new(Foo::VARIANTS) |
Feel free to create an issue for making it more convenient. |
@epage An issue or a PR? If you have a particular view on what would be the most convenient option(s) I wouldn't mind contributing. (e.g. bringing back something along the lines of |
Issue first as I prefer exploring on directions there. Once we have a direction, you are welcome to get a PR going. |
Please complete the following tasks
Rust Version
1.64.0
Clap Version
4.08
Minimal reproducible code
The text was updated successfully, but these errors were encountered: