mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
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:
parent
d4b5545099
commit
885d166f04
1 changed files with 6 additions and 2 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue