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
This commit is contained in:
Kevin K 2016-07-01 13:47:39 -04:00
parent cb251de25c
commit 96c24c9a8f

View file

@ -586,7 +586,9 @@ impl<'a, 'b> Parser<'a, 'b>
}
needs_val_of = try!(self.parse_long_arg(matcher, &arg_os));
continue;
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
continue;
}
} else if arg_os.starts_with(b"-") && arg_os.len_() != 1 {
needs_val_of = try!(self.parse_short_arg(matcher, &arg_os));
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
@ -1175,6 +1177,8 @@ impl<'a, 'b> Parser<'a, 'b>
// Handle conflicts, requirements, etc.
arg_post_processing!(self, flag, matcher);
return Ok(None);
} else if self.is_set(AppSettings::AllowLeadingHyphen) {
return Ok(None);
}