-
-
Notifications
You must be signed in to change notification settings - Fork 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
Premium typed arguments support #1506
Comments
Currently, what I do when I need this:
Used like this:
|
I know it doesn't solve your problem but: https://github.com/clap-rs/clap_derive/issues/4 I think it's better to get the CustomDerive done by now. It could enable a bunch of stuff: Like handling configuration through clap-rs |
You should be able to achieve this with |
One of the main features I'd expect from clap is to be able to specify the type of an argument, typically int, and have it provide an helpful error message is the argument cannot be parsed properly.
Currently, either one has to parse the argument string and provide an error message or move the logic to a custom validator that tries to parse and display a helpful message if it fails, but still need to parse after that (but can unwrap() as the validator already ensure the value is convertible).
I see two main options to do that:
Ideally this would also cover flags like enum, vectors (e.g comma separated) as long as the proper trait is provided (typically TryFrom/TryInto) etc...
What do you think?
The text was updated successfully, but these errors were encountered: