You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doesn't feel super great to me since you're forced into using value_delimiter and can't easily set the default to "all variants". Also, if you ever use rename_all, you'd have to ensure default_value also gets changed.
I could see an argument for adding a default_values_t attr, but since default_value_t doesn't work to begin with for Vec<impl ValueEnum>, I feel like we might as well fix default_value_t (plus I personally find it more intuitive, if I used the "typed" version for a Vec, I should be able to pass a Vec).
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): the trait bound `Vec<ArgChoice>: ArgEnum` is not satisfied
--> src/main.rs:14:9
|
14 | default_value_t = vec![ArgChoice::Foo],
| ^^^^^^^^^^^^^^^ the trait `ArgEnum` is not implemented for `Vec<ArgChoice>`
|
= help: the trait `ArgEnum` is implemented for `ArgChoice`
so changing default_value_t's behavior here for a Vec of ValueEnums wouldn't be a breaking change.
The text was updated successfully, but these errors were encountered:
Please complete the following tasks
Clap Version
3.2.10
Describe your use case
Suppose you have the following:
providing default values for
arg
doesn't feel very ergonomic to me. As far as I'm aware, you have the following options:#[clap(value_enum, value_parser, default_value="foo,bar", value_delimiter=',')]
as shown in fix: multiple default values combined withArgEnum
/PossibleValues
#3541value_delimiter
and can't easily set the default to "all variants". Also, if you ever userename_all
, you'd have to ensuredefault_value
also gets changed.default_values(...)
with something likeDescribe the solution you'd like
Fixing
default_value_t
so you can do the following:and
Alternatives, if applicable
I could see an argument for adding a
default_values_t
attr, but sincedefault_value_t
doesn't work to begin with forVec<impl ValueEnum>
, I feel like we might as well fixdefault_value_t
(plus I personally find it more intuitive, if I used the "typed" version for a Vec, I should be able to pass a Vec).Additional Context
default_value_t
doesn't work in any way:so changing
default_value_t
's behavior here for a Vec of ValueEnums wouldn't be a breaking change.The text was updated successfully, but these errors were encountered: