From 96c24c9a8fa1f85e06138d3cdd133e51659e19d2 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Fri, 1 Jul 2016 13:47:39 -0400 Subject: [PATCH] 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 --- src/app/parser.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/parser.rs b/src/app/parser.rs index 29cdfbcf..4026a9f8 100644 --- a/src/app/parser.rs +++ b/src/app/parser.rs @@ -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); }