From eb53db89f8d7f8065174f468d86dc786460e1e04 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 28 Aug 2023 09:49:48 -0500 Subject: [PATCH] feat(help): Stabilize styling support Fixes #3234 --- Makefile | 2 +- clap_builder/Cargo.toml | 2 +- clap_builder/src/builder/command.rs | 1 - clap_builder/src/builder/mod.rs | 6 ------ clap_builder/src/builder/styling.rs | 2 -- src/_features.rs | 1 - src/bin/stdio-fixture.rs | 2 +- tests/examples.rs | 2 -- tests/ui.rs | 2 -- 9 files changed, 3 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 6e81ee32a85..3ac14a7c92e 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ _FEATURES = minimal default wasm full debug release _FEATURES_minimal = --no-default-features --features "std" _FEATURES_default = _FEATURES_wasm = --no-default-features --features "std help usage error-context suggestions" --features "deprecated derive cargo env unicode string" -_FEATURES_full = --features "deprecated derive cargo env unicode string wrap_help unstable-styles" +_FEATURES_full = --features "deprecated derive cargo env unicode string wrap_help" _FEATURES_next = ${_FEATURES_full} --features unstable-v5 _FEATURES_debug = ${_FEATURES_full} --features debug --features clap_complete/debug _FEATURES_release = ${_FEATURES_full} --release diff --git a/clap_builder/Cargo.toml b/clap_builder/Cargo.toml index 336f99f91e1..f9fc506a749 100644 --- a/clap_builder/Cargo.toml +++ b/clap_builder/Cargo.toml @@ -32,7 +32,7 @@ tag-name = "v{{version}}" [features] default = ["std", "color", "help", "usage", "error-context", "suggestions"] debug = ["dep:backtrace"] # Enables debug messages -unstable-doc = ["cargo", "wrap_help", "env", "unicode", "string", "unstable-styles"] # for docs.rs +unstable-doc = ["cargo", "wrap_help", "env", "unicode", "string"] # for docs.rs # Used in default std = ["anstyle/std"] # support for no_std in a backwards-compatible way diff --git a/clap_builder/src/builder/command.rs b/clap_builder/src/builder/command.rs index 48ee1a9e2f4..17194194b8b 100644 --- a/clap_builder/src/builder/command.rs +++ b/clap_builder/src/builder/command.rs @@ -1170,7 +1170,6 @@ impl Command { #[cfg(feature = "color")] #[inline] #[must_use] - #[cfg(feature = "unstable-styles")] pub fn styles(mut self, styles: Styles) -> Self { self.app_ext.set(styles); self diff --git a/clap_builder/src/builder/mod.rs b/clap_builder/src/builder/mod.rs index ff3c6151d2a..320a45344c0 100644 --- a/clap_builder/src/builder/mod.rs +++ b/clap_builder/src/builder/mod.rs @@ -23,10 +23,7 @@ mod debug_asserts; #[cfg(test)] mod tests; -#[cfg(feature = "unstable-styles")] pub mod styling; -#[cfg(not(feature = "unstable-styles"))] -pub(crate) mod styling; pub use self::str::Str; pub use action::ArgAction; @@ -40,7 +37,6 @@ pub use range::ValueRange; pub use resettable::IntoResettable; pub use resettable::Resettable; pub use styled_str::StyledStr; -#[cfg(feature = "unstable-styles")] pub use styling::Styles; pub use value_hint::ValueHint; pub use value_parser::_AutoValueParser; @@ -69,5 +65,3 @@ pub(crate) use self::str::Inner as StrInner; pub(crate) use action::CountType; pub(crate) use arg_settings::{ArgFlags, ArgSettings}; pub(crate) use command::AppTag; -#[cfg(not(feature = "unstable-styles"))] -pub(crate) use styling::Styles; diff --git a/clap_builder/src/builder/styling.rs b/clap_builder/src/builder/styling.rs index f7f2ee1e35f..3a034489b95 100644 --- a/clap_builder/src/builder/styling.rs +++ b/clap_builder/src/builder/styling.rs @@ -10,7 +10,6 @@ pub use anstyle::*; /// /// clap v3 styling /// ```rust -/// # #[cfg(feature = "unstable-styles")] { /// # use clap_builder as clap; /// # use clap::builder::styling::*; /// let styles = Styles::styled() @@ -18,7 +17,6 @@ pub use anstyle::*; /// .usage(AnsiColor::Green.on_default()) /// .literal(AnsiColor::Green.on_default()) /// .placeholder(AnsiColor::Green.on_default()); -/// # } /// ``` #[derive(Clone, Debug)] #[allow(missing_copy_implementations)] // Large enough type that I want an explicit `clone()` for now diff --git a/src/_features.rs b/src/_features.rs index 2be4a608f12..b47ee259c28 100644 --- a/src/_features.rs +++ b/src/_features.rs @@ -26,4 +26,3 @@ //! **Warning:** These may contain breaking changes between minor releases. //! //! * **unstable-v5**: Preview features which will be stable on the v5.0 release -//! * **unstable-styles**: Custom theming support for clap diff --git a/src/bin/stdio-fixture.rs b/src/bin/stdio-fixture.rs index 792e040567a..efd6c817bdf 100644 --- a/src/bin/stdio-fixture.rs +++ b/src/bin/stdio-fixture.rs @@ -12,7 +12,7 @@ fn main() { .action(clap::ArgAction::SetTrue) .long_help("more log"), ); - #[cfg(feature = "unstable-styles")] + #[cfg(feature = "color")] { use clap::builder::styling; let styles = styling::Styles::styled() diff --git a/tests/examples.rs b/tests/examples.rs index 4dbbaab2e68..0c2766c96b9 100644 --- a/tests/examples.rs +++ b/tests/examples.rs @@ -36,8 +36,6 @@ fn example_tests() { // In-work //#[cfg(feature = "unstable-v5")] // Currently has failures //"unstable-v5", - #[cfg(feature = "unstable-styles")] - "unstable-styles", ] .join(" "); t.register_bins(trycmd::cargo::compile_examples(["--features", &features]).unwrap()); diff --git a/tests/ui.rs b/tests/ui.rs index b1328ff9513..6d325297b26 100644 --- a/tests/ui.rs +++ b/tests/ui.rs @@ -36,8 +36,6 @@ fn ui_tests() { // In-work //#[cfg(feature = "unstable-v5")] // Currently has failures //"unstable-v5", - #[cfg(feature = "unstable-styles")] - "unstable-styles", ] .join(" "); t.register_bins(trycmd::cargo::compile_examples(["--features", &features]).unwrap());