Skip to content

Commit 96c24c9

Browse files
committed
fix(AllowLeadingHyphen): fixes an issue where isn't ignored like it should be with this setting
Prior to this fix, using `AppSettings::AllowLeadingHyphen` wouldn't properly ignore `--` Closes #558
1 parent cb251de commit 96c24c9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/parser.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,9 @@ impl<'a, 'b> Parser<'a, 'b>
586586
}
587587

588588
needs_val_of = try!(self.parse_long_arg(matcher, &arg_os));
589-
continue;
589+
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
590+
continue;
591+
}
590592
} else if arg_os.starts_with(b"-") && arg_os.len_() != 1 {
591593
needs_val_of = try!(self.parse_short_arg(matcher, &arg_os));
592594
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
@@ -1175,6 +1177,8 @@ impl<'a, 'b> Parser<'a, 'b>
11751177
// Handle conflicts, requirements, etc.
11761178
arg_post_processing!(self, flag, matcher);
11771179

1180+
return Ok(None);
1181+
} else if self.is_set(AppSettings::AllowLeadingHyphen) {
11781182
return Ok(None);
11791183
}
11801184

0 commit comments

Comments
 (0)