Skip to content

Commit

Permalink
fix: fixes bug where only first arg in list of required_unless_one is…
Browse files Browse the repository at this point in the history
… recognized

Closes #575
  • Loading branch information
kbknapp committed Jul 23, 2016
1 parent fc72cdf commit 1fc3b55
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/app/parser.rs
Expand Up @@ -1606,19 +1606,21 @@ impl<'a, 'b> Parser<'a, 'b>
}
}
} else if let Some(ru) = a.required_unless() {
let mut found_any = false;
for n in ru.iter() {
if matcher.contains(n) ||
self.groups
.get(n)
.map_or(false, |g| g.args.iter().any(|an| matcher.contains(an))) {
if !a.is_set(ArgSettings::RequiredUnlessAll) {
return true;
}
} else {
return false;
}
if !a.is_set(ArgSettings::RequiredUnlessAll) {
return true;
}
found_any = true;
} else if a.is_set(ArgSettings::RequiredUnlessAll) {
return false;
}
}
return true;
return found_any;
}
false
}
Expand Down

0 comments on commit 1fc3b55

Please sign in to comment.