mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
imp(subcommands): "SUBCOMMANDS" label affected by subcommand placeholder
This commit is contained in:
parent
e5c66e58a6
commit
6d083f5653
1 changed files with 12 additions and 1 deletions
|
@ -750,7 +750,18 @@ impl<'b, 'c, 'd, 'w> Help<'b, 'c, 'd, 'w> {
|
|||
if !first {
|
||||
self.none("\n\n")?;
|
||||
}
|
||||
self.warning("SUBCOMMANDS:\n")?;
|
||||
|
||||
let subcommand_string = self.parser.app.subcommand_placeholder.unwrap_or("SUBCOMMAND");
|
||||
self.warning(subcommand_string)?;
|
||||
// TODO: simply appending an 's' doesn't work for every string.
|
||||
let pluralizer = if subcommand_string.chars().last().unwrap_or('D').is_lowercase() {
|
||||
"s"
|
||||
} else {
|
||||
"S"
|
||||
};
|
||||
self.warning(pluralizer)?;
|
||||
self.warning(":\n")?;
|
||||
|
||||
self.write_subcommands(&self.parser.app)?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue