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
This commit is contained in:
Kevin K 2016-03-29 22:25:13 -04:00
parent d4b5545099
commit 885d166f04

View file

@ -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));