From 885d166f04eb3fb581898ae5818c6c8032e5a686 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Tue, 29 Mar 2016 22:25:13 -0400 Subject: [PATCH] fix(Empty Values): fixes bug where empty values weren't stored Passing empty values, such as `--feature ""` now stores the empty string correctly as a value (assuming empty values are allowed as per the arg configuration) Closes #470 --- src/app/parser.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/parser.rs b/src/app/parser.rs index 94548772..5a6edc67 100644 --- a/src/app/parser.rs +++ b/src/app/parser.rs @@ -1028,8 +1028,12 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b { debugln!("fn=add_val_to_arg;"); let mut ret = None; if let Some(delim) = arg.val_delim() { - for v in val.split(delim as u32 as u8) { - ret = try!(self.add_single_val_to_arg(arg, v, matcher)); + if val.is_empty_() { + ret = try!(self.add_single_val_to_arg(arg, val, matcher)); + } else { + for v in val.split(delim as u32 as u8) { + ret = try!(self.add_single_val_to_arg(arg, v, matcher)); + } } } else { ret = try!(self.add_single_val_to_arg(arg, val, matcher));