From 6d083f56532ea553713380b9cd48bf99d2d3a5c0 Mon Sep 17 00:00:00 2001 From: Kitlith Date: Sat, 27 Jun 2020 14:17:47 -0700 Subject: [PATCH] imp(subcommands): "SUBCOMMANDS" label affected by subcommand placeholder --- src/output/help.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/output/help.rs b/src/output/help.rs index dbbddd9e..44794681 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -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)?; }