mirror of
https://github.com/clap-rs/clap
synced 2024-11-14 00:27:13 +00:00
Merge pull request #5094 from epage/style
feat(help): Stabilize styling support
This commit is contained in:
commit
f8e826d598
9 changed files with 3 additions and 17 deletions
2
Makefile
2
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue