From bc12e78eadd7eaf9d008a8469fdd2dfd7990cb5d Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sun, 17 May 2015 09:45:16 -0400 Subject: [PATCH] fix(args): `-` can now be parsed as a value for an argument Closes #121 --- src/app.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 165aa170e7c..35e12f7810c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1296,7 +1296,12 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{ while let Some(arg) = it.next() { let arg_slice = &arg[..]; let mut skip = false; - if !pos_only && !arg_slice.starts_with("-") && !self.subcommands.contains_key(arg_slice) { + let new_arg = if arg_slice.starts_with("-") { + if arg_slice.len() == 1 { false } else { true } + } else { + false + }; + if !pos_only && !new_arg && !self.subcommands.contains_key(arg_slice) { if let Some(nvo) = needs_val_of { if let Some(ref opt) = self.opts.get(nvo) { if let Some(ref p_vals) = opt.possible_vals {