Skip to content

Commit 885d166

Browse files
committed
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
1 parent d4b5545 commit 885d166

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/parser.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,12 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
10281028
debugln!("fn=add_val_to_arg;");
10291029
let mut ret = None;
10301030
if let Some(delim) = arg.val_delim() {
1031-
for v in val.split(delim as u32 as u8) {
1032-
ret = try!(self.add_single_val_to_arg(arg, v, matcher));
1031+
if val.is_empty_() {
1032+
ret = try!(self.add_single_val_to_arg(arg, val, matcher));
1033+
} else {
1034+
for v in val.split(delim as u32 as u8) {
1035+
ret = try!(self.add_single_val_to_arg(arg, v, matcher));
1036+
}
10331037
}
10341038
} else {
10351039
ret = try!(self.add_single_val_to_arg(arg, val, matcher));

0 commit comments

Comments
 (0)