How to use ArgAction::Append with derive instead of builder? #4331
-
Hello. I am attempting to receive multiple values passed after one flag, instead of having to repeat the flag every time I want to take another argument for it. Something like It looks like I see I can pass action values in the derive syntax via: #[clap(long, default_values = &["Solarized (dark)"], action = clap::ArgAction::Append)]
pub theme: Vec<String>, But upon running my command with
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
That is the opposite of Keep in mind what clap automatically does based on the field's type](https://docs.rs/clap/latest/clap/_derive/index.html#arg-types) as you will want to consider how much you want to undo.
The derive reference explains raw attributes and delegates documentation for them to the builder API. See also #4090 |
Beta Was this translation helpful? Give feedback.
That is the opposite of
ArgAction::Append
. Assuming you are using clap v4, you want num_args.Keep in mind what clap automatically does based on the field's type](https://docs.rs/clap/latest/clap/_derive/index.html#arg-types) as you will want to consider how much you want to undo.
The derive reference explains raw attributes and delegates documentation for them to the builder API.
See also #4090