fix: now correctly shows subcommand as required in the usage string when AppSettings::SubcommandRequiredElseHelp is used

Close #883
This commit is contained in:
Kevin K 2017-03-04 15:14:10 -05:00
parent 91d8280322
commit 97e8db23b3
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -2139,7 +2139,8 @@ impl<'a, 'b> Parser<'a, 'b>
if self.has_subcommands() && !self.is_set(AS::SubcommandRequired) {
usage.push_str(" [SUBCOMMAND]");
} else if self.is_set(AS::SubcommandRequired) && self.has_subcommands() {
} else if (self.is_set(AS::SubcommandRequired) ||
self.is_set(AS::SubcommandRequiredElseHelp)) && self.has_subcommands() {
usage.push_str(" <SUBCOMMAND>");
}
} else {