-
I'm working on a CLI interface that takes multiple consecutive parameters that are comma-delimited lists. These are consecutive positional arguments, followed by some other positional arguments. Example usage: This is the current setup I'm using: #[derive(Parser, Debug)]
struct Cli {
#[clap(num_args = 1.., value_delimiter = ',')]
first: Vec<String>,
#[clap(num_args = 1.., value_delimiter = ',')]
second: Vec<u64>,
third: PathBuf,
} Usually spaces are used to delimit values in vectors, so it is ambiguous which value belongs to which vector. As a result, In my case, I want spaces to denote the end of an argument - solely relying on the commas to delimit items in a list. I hoped I also tried using Is there a way to get the behaviour I want without enforcing I could use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Set |
Beta Was this translation helpful? Give feedback.
Check out the arg types referencehttps://docs.rs/clap/latest/clap/_derive/index.html#arg-types). You'll need to undo what it does. In particular, you also need to set
ArgAction::Set
.#4626 is the issue trying to figure out a way to improve this.