-
-
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
Allow a field's type to be different than the value parser type #3912
Comments
What would we call these new attributes? |
If we use serde as an example, it has In terms of output type, would just having |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
As an update, we've loosened this restriction for SetTrue/SetFalse in the 4.0 release, see #4095 for the latest version of it |
Please complete the following tasks
Clap Version
3.2.8
Describe your use case
Some value parsers (
Count
,SetTrue
,SetFalse
) only support one specific data type but the user might want to support a different user type.For example, the following
parse(from_flag)
test cannot be ported tovalue_parser
(a
SetConst
might also work to a degree)Others might want a different count type than
u8
.Someone even brought up processing a
Vec<String>
into aString
, see #3905 (reply in thread)Describe the solution you'd like
The user should be able to
ValueParser
output type to use withget_one
/get_many
TryInto
(orInto
?)This will only be called when extracting the fields and will only be called once. We will not do a proper validation step for this.
Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: