From 1fc3b55bd6c8653b02e7c4253749c6b77737d2ac Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sat, 23 Jul 2016 17:21:41 -0400 Subject: [PATCH] fix: fixes bug where only first arg in list of required_unless_one is recognized Closes #575 --- src/app/parser.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app/parser.rs b/src/app/parser.rs index 4f7f872d0e4..def0f237fe8 100644 --- a/src/app/parser.rs +++ b/src/app/parser.rs @@ -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 }