Repository: clap-rs/clap
Pull request #6057 (2025-07-01 20:41:19)

feat(help): Allow styling for inline context
Styles for [aliases], [default], [env], and [possible values] as well as their values

fix https://github.com/clap-rs/clap/issues/5093

Continuation of PR https://github.com/clap-rs/clap/pull/5482 but clean.

I created an issue (https://github.com/clap-rs/clap/issues/6056) about `literal` possible values in long help for when 5.0 is rolling out as @pksunkara asked. 

I added more granularity in the styling of each "context" but still a general one to style all of them at once too.


GilShoshan94: I don't understand why I fails rustfmt check???

When I run `cargo fmt --all -- --check` I get nothing, and it passes.
I ran `cargo fmt --all` and nothing gets edited.

What am I missing?
GilShoshan94: Hi @epage,

I am guessing you are very busy, but I am too, and I would like to finish this PR asap.

When will you be more available to react to my replies and comments?
I just updated the PR and now it passes the CI.
epage: Understand that you posted during a US holiday. I've been with my family. It is not healthy for maintainers to be pressured to respond at all time like that. Yes, I didn't get to it today but it takes time to catch up.

Patch:
diff --git a/Cargo.lock b/Cargo.lock
index f2f28c20..64b75e04 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1406,9 +1406,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
 
 [[package]]
 name = "jiff"
-version = "0.2.15"
+version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
+checksum = "a194df1107f33c79f4f93d02c80798520551949d59dfad22b6157048a88cca93"
 dependencies = [
  "jiff-static",
  "jiff-tzdb-platform",
@@ -1421,9 +1421,9 @@ dependencies = [
 
 [[package]]
 name = "jiff-static"
-version = "0.2.15"
+version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
+checksum = "6c6e1db7ed32c6c71b759497fae34bf7933636f75a251b9e736555da426f6442"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1971,7 +1971,7 @@ dependencies = [
  "tabled",
  "terminal_size 0.3.0",
  "titlecase",
- "toml 0.8.14",
+ "toml",
  "umask",
  "unicode-segmentation",
  "ureq",
@@ -2949,15 +2949,6 @@ dependencies = [
  "serde",
 ]
 
-[[package]]
-name = "serde_spanned"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
-dependencies = [
- "serde",
-]
-
 [[package]]
 name = "serde_urlencoded"
 version = "0.7.1"
@@ -3384,26 +3375,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
 dependencies = [
  "serde",
- "serde_spanned 0.6.6",
- "toml_datetime 0.6.6",
+ "serde_spanned",
+ "toml_datetime",
  "toml_edit",
 ]
 
-[[package]]
-name = "toml"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f271e09bde39ab52250160a67e88577e0559ad77e9085de6e9051a2c4353f8f8"
-dependencies = [
- "indexmap",
- "serde",
- "serde_spanned 1.0.0",
- "toml_datetime 0.7.0",
- "toml_parser",
- "toml_writer",
- "winnow 0.7.11",
-]
-
 [[package]]
 name = "toml_datetime"
 version = "0.6.6"
@@ -3413,15 +3389,6 @@ dependencies = [
  "serde",
 ]
 
-[[package]]
-name = "toml_datetime"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
-dependencies = [
- "serde",
-]
-
 [[package]]
 name = "toml_edit"
 version = "0.22.15"
@@ -3430,31 +3397,16 @@ checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1"
 dependencies = [
  "indexmap",
  "serde",
- "serde_spanned 0.6.6",
- "toml_datetime 0.6.6",
- "winnow 0.6.13",
-]
-
-[[package]]
-name = "toml_parser"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5c1c469eda89749d2230d8156a5969a69ffe0d6d01200581cdc6110674d293e"
-dependencies = [
- "winnow 0.7.11",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
 ]
 
-[[package]]
-name = "toml_writer"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b679217f2848de74cabd3e8fc5e6d66f40b7da40f8e1954d92054d9010690fd5"
-
 [[package]]
 name = "trybuild"
-version = "1.0.106"
+version = "1.0.105"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65af40ad689f2527aebbd37a0a816aea88ff5f774ceabe99de5be02f2f91dae2"
+checksum = "1c9bf9513a2f4aeef5fdac8677d7d349c79fdbcc03b9c86da6e9d254f1e43be2"
 dependencies = [
  "glob",
  "serde",
@@ -3462,7 +3414,7 @@ dependencies = [
  "serde_json",
  "target-triple",
  "termcolor",
- "toml 0.9.0",
+ "toml",
 ]
 
 [[package]]
@@ -4168,12 +4120,6 @@ dependencies = [
  "memchr",
 ]
 
-[[package]]
-name = "winnow"
-version = "0.7.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
-
 [[package]]
 name = "winreg"
 version = "0.52.0"
diff --git a/clap_builder/src/builder/styling.rs b/clap_builder/src/builder/styling.rs
index b00365ad..58eb159f 100644
--- a/clap_builder/src/builder/styling.rs
+++ b/clap_builder/src/builder/styling.rs
@@ -28,6 +28,8 @@ pub struct Styles {
     placeholder: Style,
     valid: Style,
     invalid: Style,
+    context: Style,
+    context_value: Option<Style>,
 }
 
 impl Styles {
@@ -41,6 +43,8 @@ impl Styles {
             placeholder: Style::new(),
             valid: Style::new(),
             invalid: Style::new(),
+            context: Style::new(),
+            context_value: None,
         }
     }
 
@@ -58,6 +62,8 @@ impl Styles {
                 placeholder: Style::new(),
                 valid: Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green))),
                 invalid: Style::new().fg_color(Some(Color::Ansi(AnsiColor::Yellow))),
+                context: Style::new(),
+                context_value: None,
             }
         }
         #[cfg(not(feature = "color"))]
@@ -114,6 +120,24 @@ impl Styles {
         self.invalid = style;
         self
     }
+
+    /// Highlight all specified contexts, e.g. `[default: false]`
+    ///
+    /// To specialize the style of the value within the context, see [`Styles::context_value`]
+    #[inline]
+    pub const fn context(mut self, style: Style) -> Self {
+        self.context = style;
+        self
+    }
+
+    /// Highlight values within all of the context, e.g. the `false` in `[default: false]`
+    ///
+    /// If not explicitly set, falls back to `context`'s style.
+    #[inline]
+    pub const fn context_value(mut self, style: Style) -> Self {
+        self.context_value = Some(style);
+        self
+    }
 }
 
 /// Reflection
@@ -159,6 +183,25 @@ impl Styles {
     pub const fn get_invalid(&self) -> &Style {
         &self.invalid
     }
+
+    /// Highlight all specified contexts, e.g. `[default: false]`
+    ///
+    /// To specialize the style of the value within the context, see [`Styles::context_value`]
+    #[inline(always)]
+    pub const fn get_context(&self) -> &Style {
+        &self.context
+    }
+
+    /// Highlight values within all of the context, e.g. the `false` in `[default: false]`
+    ///
+    /// If not explicitly set, falls back to `context`'s style.
+    #[inline(always)]
+    pub const fn get_context_value(&self) -> &Style {
+        match &self.context_value {
+            Some(s) => s,
+            None => &self.context,
+        }
+    }
 }
 
 impl super::AppExt for Styles {}
diff --git a/clap_builder/src/output/help_template.rs b/clap_builder/src/output/help_template.rs
index 51f98f03..5ac11fe7 100644
--- a/clap_builder/src/output/help_template.rs
+++ b/clap_builder/src/output/help_template.rs
@@ -739,6 +739,10 @@ impl HelpTemplate<'_, '_> {
 
     fn spec_vals(&self, a: &Arg) -> String {
         debug!("HelpTemplate::spec_vals: a={a}");
+        let ctx = &self.styles.get_context();
+        let ctx_val = &self.styles.get_context_value();
+        let val_sep = format!("{ctx}, {ctx:#}"); // context values styled separator
+
         let mut spec_vals = Vec::new();
         #[cfg(feature = "env")]
         if let Some(ref env) = a.env {
@@ -758,7 +762,11 @@ impl HelpTemplate<'_, '_> {
                 } else {
                     Default::default()
                 };
-                let env_info = format!("[env: {}{}]", env.0.to_string_lossy(), env_val);
+                let env_info = format!(
+                    "{ctx}[env: {ctx:#}{ctx_val}{}{}{ctx_val:#}{ctx}]{ctx:#}",
+                    env.0.to_string_lossy(),
+                    env_val
+                );
                 spec_vals.push(env_info);
             }
         }
@@ -768,21 +776,23 @@ impl HelpTemplate<'_, '_> {
                 a.default_vals
             );
 
-            let pvs = a
+            let dvs = a
                 .default_vals
                 .iter()
-                .map(|pvs| pvs.to_string_lossy())
-                .map(|pvs| {
-                    if pvs.contains(char::is_whitespace) {
-                        Cow::from(format!("{pvs:?}"))
+                .map(|dv| dv.to_string_lossy())
+                .map(|dv| {
+                    if dv.contains(char::is_whitespace) {
+                        Cow::from(format!("{dv:?}"))
                     } else {
-                        pvs
+                        dv
                     }
                 })
                 .collect::<Vec<_>>()
                 .join(" ");
 
-            spec_vals.push(format!("[default: {pvs}]"));
+            spec_vals.push(format!(
+                "{ctx}[default: {ctx:#}{ctx_val}{dvs}{ctx_val:#}{ctx}]{ctx:#}"
+            ));
         }
 
         let mut als = Vec::new();
@@ -791,7 +801,7 @@ impl HelpTemplate<'_, '_> {
             .short_aliases
             .iter()
             .filter(|&als| als.1) // visible
-            .map(|als| format!("-{}", als.0)); // name
+            .map(|als| format!("{ctx_val}-{}{ctx_val:#}", als.0)); // name
         debug!(
             "HelpTemplate::spec_vals: Found short aliases...{:?}",
             a.short_aliases
@@ -802,12 +812,13 @@ impl HelpTemplate<'_, '_> {
             .aliases
             .iter()
             .filter(|&als| als.1) // visible
-            .map(|als| format!("--{}", als.0)); // name
+            .map(|als| format!("{ctx_val}--{}{ctx_val:#}", als.0)); // name
         debug!("HelpTemplate::spec_vals: Found aliases...{:?}", a.aliases);
         als.extend(long_als);
 
         if !als.is_empty() {
-            spec_vals.push(format!("[aliases: {}]", als.join(", ")));
+            let als = als.join(&val_sep);
+            spec_vals.push(format!("{ctx}[aliases: {ctx:#}{als}{ctx}]{ctx:#}"));
         }
 
         if !a.is_hide_possible_values_set() && !self.use_long_pv(a) {
@@ -818,10 +829,11 @@ impl HelpTemplate<'_, '_> {
                 let pvs = possible_vals
                     .iter()
                     .filter_map(PossibleValue::get_visible_quoted_name)
+                    .map(|pv| format!("{ctx_val}{pv}{ctx_val:#}"))
                     .collect::<Vec<_>>()
-                    .join(", ");
+                    .join(&val_sep);
 
-                spec_vals.push(format!("[possible values: {pvs}]"));
+                spec_vals.push(format!("{ctx}[possible values: {ctx:#}{pvs}{ctx}]{ctx:#}"));
             }
         }
         let connector = if self.use_long { "\n" } else { " " };
@@ -984,15 +996,20 @@ impl HelpTemplate<'_, '_> {
 
     fn sc_spec_vals(&self, a: &Command) -> String {
         debug!("HelpTemplate::sc_spec_vals: a={}", a.get_name());
+        let ctx = &self.styles.get_context();
+        let ctx_val = &self.styles.get_context_value();
+        let val_sep = format!("{ctx}, {ctx:#}"); // context values styled separator
         let mut spec_vals = vec![];
 
         let mut short_als = a
             .get_visible_short_flag_aliases()
-            .map(|a| format!("-{a}"))
+            .map(|a| format!("{ctx_val}-{a}{ctx_val:#}"))
             .collect::<Vec<_>>();
-        let als = a.get_visible_aliases().map(|s| s.to_string());
+        let als = a
+            .get_visible_aliases()
+            .map(|s| format!("{ctx_val}{s}{ctx_val:#}"));
         short_als.extend(als);
-        let all_als = short_als.join(", ");
+        let all_als = short_als.join(&val_sep);
         if !all_als.is_empty() {
             debug!(
                 "HelpTemplate::spec_vals: Found aliases...{:?}",
@@ -1002,7 +1019,7 @@ impl HelpTemplate<'_, '_> {
                 "HelpTemplate::spec_vals: Found short flag aliases...{:?}",
                 a.get_all_short_flag_aliases().collect::<Vec<_>>()
             );
-            spec_vals.push(format!("[aliases: {all_als}]"));
+            spec_vals.push(format!("{ctx}[aliases: {ctx:#}{all_als}{ctx}]{ctx:#}"));
         }
 
         spec_vals.join(" ")
diff --git a/src/bin/stdio-fixture.rs b/src/bin/stdio-fixture.rs
index 03ecd1fd..d34e3d37 100644
--- a/src/bin/stdio-fixture.rs
+++ b/src/bin/stdio-fixture.rs
@@ -1,25 +1,105 @@
+use clap::{builder::PossibleValue, Arg, ArgAction, Command};
+
 fn main() {
     #[allow(unused_mut)]
-    let mut cmd = clap::Command::new("stdio-fixture")
+    let mut cmd = Command::new("stdio-fixture")
         .version("1.0")
         .long_version("1.0 - a2132c")
         .arg_required_else_help(true)
-        .subcommand(clap::Command::new("more"))
+        .subcommand(Command::new("more"))
+        .subcommand(
+            Command::new("test")
+                .visible_alias("do-stuff")
+                .long_about("Subcommand with one visible alias"),
+        )
+        .subcommand(
+            Command::new("test_2")
+                .visible_aliases(["do-other-stuff", "tests"])
+                .about("several visible aliases")
+                .long_about("Subcommand with multiple visible aliases"),
+        )
+        .subcommand(
+            Command::new("test_3")
+                .long_flag("test")
+                .about("several visible long flag aliases")
+                .visible_long_flag_aliases(["testing", "testall", "test_all"]),
+        )
+        .subcommand(
+            Command::new("test_4")
+                .short_flag('t')
+                .about("several visible short flag aliases")
+                .visible_short_flag_aliases(['q', 'w']),
+        )
+        .subcommand(
+            Command::new("test_5")
+                .short_flag('e')
+                .long_flag("test-hdr")
+                .about("all kinds of visible aliases")
+                .visible_aliases(["tests_4k"])
+                .visible_long_flag_aliases(["thetests", "t4k"])
+                .visible_short_flag_aliases(['r', 'y']),
+        )
         .arg(
-            clap::Arg::new("verbose")
+            Arg::new("verbose")
                 .long("verbose")
                 .help("log")
-                .action(clap::ArgAction::SetTrue)
+                .action(ArgAction::SetTrue)
                 .long_help("more log"),
+        )
+        .arg(
+            Arg::new("config")
+                .action(ArgAction::Set)
+                .help("Speed configuration")
+                .short('c')
+                .long("config")
+                .value_name("MODE")
+                .value_parser([
+                    PossibleValue::new("fast"),
+                    PossibleValue::new("slow").help("slower than fast"),
+                    PossibleValue::new("secret speed").hide(true),
+                ])
+                .default_value("fast"),
+        )
+        .arg(
+            Arg::new("name")
+                .action(ArgAction::Set)
+                .help("App name")
+                .long_help("Set the instance app name")
+                .value_name("NAME")
+                .visible_alias("app-name")
+                .default_value("clap"),
+        )
+        .arg(
+            Arg::new("fruits")
+                .short('f')
+                .visible_short_alias('b')
+                .action(ArgAction::Append)
+                .value_name("FRUITS")
+                .help("List of fruits")
+                .default_values(["apple", "banane", "orange"]),
         );
+    #[cfg(feature = "env")]
+    {
+        cmd = cmd.arg(
+            Arg::new("env_arg")
+                .help("Read from env var when arg is not present.")
+                .value_name("ENV")
+                .env("ENV_ARG"),
+        );
+    }
     #[cfg(feature = "color")]
     {
-        use clap::builder::styling;
-        const STYLES: styling::Styles = styling::Styles::styled()
-            .header(styling::AnsiColor::Green.on_default().bold())
-            .usage(styling::AnsiColor::Green.on_default().bold())
-            .literal(styling::AnsiColor::Blue.on_default().bold())
-            .placeholder(styling::AnsiColor::Cyan.on_default());
+        use clap::builder::styling::{AnsiColor, Styles};
+        const STYLES: Styles = Styles::styled()
+            .header(AnsiColor::Green.on_default().bold())
+            .error(AnsiColor::Red.on_default().bold())
+            .usage(AnsiColor::Green.on_default().bold().underline())
+            .literal(AnsiColor::Blue.on_default().bold())
+            .placeholder(AnsiColor::Cyan.on_default())
+            .valid(AnsiColor::Green.on_default())
+            .invalid(AnsiColor::Magenta.on_default().bold())
+            .context(AnsiColor::Yellow.on_default().dimmed())
+            .context_value(AnsiColor::Yellow.on_default().italic());
         cmd = cmd.styles(STYLES);
     }
     cmd.get_matches();


Test patch:
diff --git a/tests/ui/arg_required_else_help_stderr.toml b/tests/ui/arg_required_else_help_stderr.toml
index 7f166daf..bb023bae 100644
--- a/tests/ui/arg_required_else_help_stderr.toml
+++ b/tests/ui/arg_required_else_help_stderr.toml
@@ -3,14 +3,25 @@ args = []
 status.code = 2
 stdout = ""
 stderr = """
-Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
+Usage: stdio-fixture[EXE] [OPTIONS] [NAME] [ENV] [COMMAND]
 
 Commands:
-  more  
-  help  Print this message or the help of the given subcommand(s)
+  more                    
+  test                    Subcommand with one visible alias [aliases: do-stuff]
+  test_2                  several visible aliases [aliases: do-other-stuff, tests]
+  test_3, --test          several visible long flag aliases
+  test_4, -t              several visible short flag aliases [aliases: -q, -w]
+  test_5, -e, --test-hdr  all kinds of visible aliases [aliases: -r, -y, tests_4k]
+  help                    Print this message or the help of the given subcommand(s)
+
+Arguments:
+  [NAME]  App name [default: clap] [aliases: --app-name]
+  [ENV]   Read from env var when arg is not present. [env: ENV_ARG=]
 
 Options:
-      --verbose  log
-  -h, --help     Print help (see more with '--help')
-  -V, --version  Print version
+      --verbose        log
+  -c, --config <MODE>  Speed configuration [default: fast] [possible values: fast, slow]
+  -f <FRUITS>          List of fruits [default: apple banane orange] [aliases: -b]
+  -h, --help           Print help (see more with '--help')
+  -V, --version        Print version
 """
diff --git a/tests/ui/error_stderr.toml b/tests/ui/error_stderr.toml
index 20efbfc9..cbdae24a 100644
--- a/tests/ui/error_stderr.toml
+++ b/tests/ui/error_stderr.toml
@@ -5,7 +5,9 @@ stdout = ""
 stderr = """
 error: unexpected argument '--unknown-argument' found
 
-Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
+  tip: to pass '--unknown-argument' as a value, use '-- --unknown-argument'
+
+Usage: stdio-fixture[EXE] [OPTIONS] [NAME] [ENV] [COMMAND]
 
 For more information, try '--help'.
 """
diff --git a/tests/ui/h_flag_stdout.toml b/tests/ui/h_flag_stdout.toml
index ef031b08..3436e117 100644
--- a/tests/ui/h_flag_stdout.toml
+++ b/tests/ui/h_flag_stdout.toml
@@ -2,15 +2,26 @@ bin.name = "stdio-fixture"
 args = ["-h"]
 status.code = 0
 stdout = """
-Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
+Usage: stdio-fixture[EXE] [OPTIONS] [NAME] [ENV] [COMMAND]
 
 Commands:
-  more  
-  help  Print this message or the help of the given subcommand(s)
+  more                    
+  test                    Subcommand with one visible alias [aliases: do-stuff]
+  test_2                  several visible aliases [aliases: do-other-stuff, tests]
+  test_3, --test          several visible long flag aliases
+  test_4, -t              several visible short flag aliases [aliases: -q, -w]
+  test_5, -e, --test-hdr  all kinds of visible aliases [aliases: -r, -y, tests_4k]
+  help                    Print this message or the help of the given subcommand(s)
+
+Arguments:
+  [NAME]  App name [default: clap] [aliases: --app-name]
+  [ENV]   Read from env var when arg is not present. [env: ENV_ARG=]
 
 Options:
-      --verbose  log
-  -h, --help     Print help (see more with '--help')
-  -V, --version  Print version
+      --verbose        log
+  -c, --config <MODE>  Speed configuration [default: fast] [possible values: fast, slow]
+  -f <FRUITS>          List of fruits [default: apple banane orange] [aliases: -b]
+  -h, --help           Print help (see more with '--help')
+  -V, --version        Print version
 """
 stderr = ""
diff --git a/tests/ui/help_cmd_stdout.toml b/tests/ui/help_cmd_stdout.toml
index 550a753a..ffdc39dd 100644
--- a/tests/ui/help_cmd_stdout.toml
+++ b/tests/ui/help_cmd_stdout.toml
@@ -2,16 +2,48 @@ bin.name = "stdio-fixture"
 args = ["help"]
 status.code = 0
 stdout = """
-Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
+Usage: stdio-fixture[EXE] [OPTIONS] [NAME] [ENV] [COMMAND]
 
 Commands:
-  more  
-  help  Print this message or the help of the given subcommand(s)
+  more                    
+  test                    Subcommand with one visible alias [aliases: do-stuff]
+  test_2                  several visible aliases [aliases: do-other-stuff, tests]
+  test_3, --test          several visible long flag aliases
+  test_4, -t              several visible short flag aliases [aliases: -q, -w]
+  test_5, -e, --test-hdr  all kinds of visible aliases [aliases: -r, -y, tests_4k]
+  help                    Print this message or the help of the given subcommand(s)
+
+Arguments:
+  [NAME]
+          Set the instance app name
+          
+          [default: clap]
+          [aliases: --app-name]
+
+  [ENV]
+          Read from env var when arg is not present.
+          
+          [env: ENV_ARG=]
 
 Options:
       --verbose
           more log
 
+  -c, --config <MODE>
+          Speed configuration
+          
+          [default: fast]
+
+          Possible values:
+          - fast
+          - slow: slower than fast
+
+  -f <FRUITS>
+          List of fruits
+          
+          [default: apple banane orange]
+          [aliases: -b]
+
   -h, --help
           Print help (see a summary with '-h')
 
diff --git a/tests/ui/help_flag_stdout.toml b/tests/ui/help_flag_stdout.toml
index 29241b21..79193808 100644
--- a/tests/ui/help_flag_stdout.toml
+++ b/tests/ui/help_flag_stdout.toml
@@ -2,16 +2,48 @@ bin.name = "stdio-fixture"
 args = ["--help"]
 status.code = 0
 stdout = """
-Usage: stdio-fixture[EXE] [OPTIONS] [COMMAND]
+Usage: stdio-fixture[EXE] [OPTIONS] [NAME] [ENV] [COMMAND]
 
 Commands:
-  more  
-  help  Print this message or the help of the given subcommand(s)
+  more                    
+  test                    Subcommand with one visible alias [aliases: do-stuff]
+  test_2                  several visible aliases [aliases: do-other-stuff, tests]
+  test_3, --test          several visible long flag aliases
+  test_4, -t              several visible short flag aliases [aliases: -q, -w]
+  test_5, -e, --test-hdr  all kinds of visible aliases [aliases: -r, -y, tests_4k]
+  help                    Print this message or the help of the given subcommand(s)
+
+Arguments:
+  [NAME]
+          Set the instance app name
+          
+          [default: clap]
+          [aliases: --app-name]
+
+  [ENV]
+          Read from env var when arg is not present.
+          
+          [env: ENV_ARG=]
 
 Options:
       --verbose
           more log
 
+  -c, --config <MODE>
+          Speed configuration
+          
+          [default: fast]
+
+          Possible values:
+          - fast
+          - slow: slower than fast
+
+  -f <FRUITS>
+          List of fruits
+          
+          [default: apple banane orange]
+          [aliases: -b]
+
   -h, --help
           Print help (see a summary with '-h')