Skip to content

Commit

Permalink
fix: now correctly shows subcommand as required in the usage string w…
Browse files Browse the repository at this point in the history
…hen AppSettings::SubcommandRequiredElseHelp is used

Close #883
  • Loading branch information
kbknapp committed Mar 9, 2017
1 parent 6274554 commit 61d7ce4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,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 {
Expand Down

0 comments on commit 61d7ce4

Please sign in to comment.