Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(help): Fill in styles docs #4845

Merged
merged 2 commits into from Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions clap_builder/src/builder/command.rs
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