From cfc93c534ad8c990b2bd8f7ce0cda542ab41d416 Mon Sep 17 00:00:00 2001 From: Vincent Junge Date: Fri, 24 May 2024 20:02:22 +0200 Subject: [PATCH] allow positional arguments starting with a dash --- argh/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/argh/src/lib.rs b/argh/src/lib.rs index d56d1f0..a6c795e 100644 --- a/argh/src/lib.rs +++ b/argh/src/lib.rs @@ -930,7 +930,9 @@ pub fn parse_struct_args( return Err("Trailing arguments are not allowed after `help`.".to_string().into()); } - parse_options.parse(next_arg, &mut remaining_args)?; + if parse_options.parse(next_arg, &mut remaining_args).is_err() { + options_ended |= parse_positionals.parse(&mut positional_index, next_arg)?; + } continue; }