Skip to content

Commit

Permalink
Merge pull request #4845 from epage/color
Browse files Browse the repository at this point in the history
docs(help): Fill in styles docs
  • Loading branch information
epage authored Apr 19, 2023
2 parents b99c50f + 1ca073f commit e429a9e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions clap_builder/src/builder/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,22 +1081,21 @@ impl Command {
}
}

/// Sets when to color output.
/// Sets the [`Styles`] for terminal output
///
/// **NOTE:** This choice is propagated to all child subcommands.
///
/// **NOTE:** Default behaviour is [`ColorChoice::Auto`].
/// **NOTE:** Default behaviour is [`Styles::default`].
///
/// # Examples
///
/// ```no_run
/// # use clap_builder as clap;
/// # use clap::{Command, ColorChoice};
/// # use clap::{Command, ColorChoice, builder::Styles};
/// Command::new("myprog")
/// .color(ColorChoice::Never)
/// .styles(Styles::styled().usage(Default::default()))
/// .get_matches();
/// ```
/// [`ColorChoice::Auto`]: crate::ColorChoice::Auto
#[cfg(feature = "color")]
#[inline]
#[must_use]
Expand Down Expand Up @@ -3364,7 +3363,9 @@ impl Command {
}
}

pub(crate) fn get_styles(&self) -> &Styles {
/// Return the current `Styles` for the `Command`
#[inline]
pub fn get_styles(&self) -> &Styles {
self.app_ext.get().unwrap_or_default()
}

Expand Down

0 comments on commit e429a9e

Please sign in to comment.