fix(ArgRequiredElseHelp): fixes the precedence of this error to prioritize over other error messages

Closes #895
This commit is contained in:
Kevin K 2017-03-12 12:52:09 -04:00
parent b049cecccc
commit 74b751ff2e
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -49,13 +49,6 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> {
} }
} }
try!(self.validate_blacklist(matcher));
if !(self.0.is_set(AS::SubcommandsNegateReqs) && subcmd_name.is_some()) && !reqs_validated {
try!(self.validate_required(matcher));
}
try!(self.validate_matched_args(matcher));
matcher.usage(usage::create_usage_with_title(self.0, &[]));
if matcher.is_empty() && matcher.subcommand_name().is_none() && if matcher.is_empty() && matcher.subcommand_name().is_none() &&
self.0.is_set(AS::ArgRequiredElseHelp) { self.0.is_set(AS::ArgRequiredElseHelp) {
let mut out = vec![]; let mut out = vec![];
@ -66,6 +59,13 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> {
info: None, info: None,
}); });
} }
try!(self.validate_blacklist(matcher));
if !(self.0.is_set(AS::SubcommandsNegateReqs) && subcmd_name.is_some()) && !reqs_validated {
try!(self.validate_required(matcher));
}
try!(self.validate_matched_args(matcher));
matcher.usage(usage::create_usage_with_title(self.0, &[]));
Ok(()) Ok(())
} }