diff --git a/clap_builder/src/builder/styled_str.rs b/clap_builder/src/builder/styled_str.rs index 13a81bec..ed72b516 100644 --- a/clap_builder/src/builder/styled_str.rs +++ b/clap_builder/src/builder/styled_str.rs @@ -207,6 +207,8 @@ pub struct Styles { pub header: anstyle::Style, /// Error heading pub error: anstyle::Style, + /// Usage heading + pub usage: anstyle::Style, /// Literal command-line syntax, e.g. `--help` pub literal: anstyle::Style, /// Descriptions within command-line syntax, e.g. [`value_name`][crate::Arg::value_name] @@ -223,6 +225,7 @@ impl Styles { Self { header: anstyle::Style::new(), error: anstyle::Style::new(), + usage: anstyle::Style::new(), literal: anstyle::Style::new(), placeholder: anstyle::Style::new(), valid: anstyle::Style::new(), @@ -239,6 +242,7 @@ impl Styles { error: anstyle::Style::new() .fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Red))) .bold(), + usage: anstyle::Style::new().bold().underline(), literal: anstyle::Style::new().bold(), placeholder: anstyle::Style::new(), valid: anstyle::Style::new() diff --git a/clap_builder/src/output/help_template.rs b/clap_builder/src/output/help_template.rs index 2668edd4..703a1f47 100644 --- a/clap_builder/src/output/help_template.rs +++ b/clap_builder/src/output/help_template.rs @@ -130,7 +130,6 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { pub(crate) fn write_templated_help(&mut self, template: &str) { debug!("HelpTemplate::write_templated_help"); use std::fmt::Write as _; - let header = &self.styles.header; let mut parts = template.split('{'); if let Some(first) = parts.next() { @@ -171,8 +170,8 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { let _ = write!( self.writer, "{}Usage:{}", - header.render(), - header.render_reset() + self.styles.usage.render(), + self.styles.usage.render_reset() ); } "usage" => { diff --git a/clap_builder/src/output/usage.rs b/clap_builder/src/output/usage.rs index ffef25d4..1eb9139d 100644 --- a/clap_builder/src/output/usage.rs +++ b/clap_builder/src/output/usage.rs @@ -41,13 +41,12 @@ impl<'cmd> Usage<'cmd> { let usage = some!(self.create_usage_no_title(used)); use std::fmt::Write as _; - let header = &self.styles.header; let mut styled = StyledStr::new(); let _ = write!( styled, "{}Usage:{} ", - header.render(), - header.render_reset() + self.styles.usage.render(), + self.styles.usage.render_reset() ); styled.push_styled(&usage); Some(styled)