mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 06:12:40 +00:00
fix: now correctly shows subcommand as required in the usage string when AppSettings::SubcommandRequiredElseHelp is used
Close #883
This commit is contained in:
parent
91d8280322
commit
97e8db23b3
1 changed files with 2 additions and 1 deletions
|
@ -2139,7 +2139,8 @@ impl<'a, 'b> Parser<'a, 'b>
|
||||||
|
|
||||||
if self.has_subcommands() && !self.is_set(AS::SubcommandRequired) {
|
if self.has_subcommands() && !self.is_set(AS::SubcommandRequired) {
|
||||||
usage.push_str(" [SUBCOMMAND]");
|
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>");
|
usage.push_str(" <SUBCOMMAND>");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue