Force optional arguments precede positional arguments #5418
Answered
by
epage
smallkirby
asked this question in
Q&A
-
I have two arguments: one is a vector of strings, and the other is an optional value. #[derive(Parser, Debug)]
struct Args {
/// Text
#[arg()]
texts: Vec<String>,
/// Do not print newline
#[arg(short = 'n', default_value = "false")]
newline: bool,
} When executing In short, I believe I need to ensure that optional arguments precede positional arguments. I would appreciate it if anyone knows of a solution. |
Beta Was this translation helpful? Give feedback.
Answered by
epage
Mar 23, 2024
Replies: 1 comment 1 reply
-
Try setting |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
smallkirby
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try setting
allow_hyphen_values = true