Skip to content

Commit

Permalink
cargo: Fix default features and make them all additive
Browse files Browse the repository at this point in the history
  • Loading branch information
tavianator authored and sharkdp committed Nov 29, 2023
1 parent dda76fb commit 542ca9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ authors = ["David Peter <mail@david-peter.de>"]
rust-version = "1.63.0"

[features]
default = []
default = ["nu-ansi-term"]
gnu_legacy = ["nu-ansi-term/gnu_legacy"]

[dependencies]
ansi_term = { version = "0.12", optional = true }
nu-ansi-term = { version = "0.49", optional = true }
gnu_legacy = { package = "nu-ansi-term", version = "0.49", features = ["gnu_legacy"], optional = true }
crossterm = { version = "0.26", optional = true }

[dev-dependencies]
Expand Down
10 changes: 3 additions & 7 deletions src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
//!
//! For more information, see
//! [ANSI escape code (Wikipedia)](https://en.wikipedia.org/wiki/ANSI_escape_code).
#[cfg(all(feature = "nu-ansi-term", feature = "gnu_legacy"))]
compile_error!("`nu-ansi-term` and `gnu_legacy` may not be used at the same time");
#[cfg(feature = "gnu_legacy")]
use gnu_legacy as nu_ansi_term;
#[cfg(feature = "nu-ansi-term")]
use nu_ansi_term;
use std::collections::VecDeque;
Expand Down Expand Up @@ -408,7 +404,7 @@ impl Style {
///
/// ## Example for nu-ansi-term feature
/// ```
/// # #[cfg(feature = "nu-ansi-term")]
/// # #[cfg(all(feature = "nu-ansi-term", not(feature = "gnu_legacy")))]
/// # {
///
/// use lscolors::{Color, FontStyle, Style};
Expand Down Expand Up @@ -662,7 +658,7 @@ mod tests {
);
}

#[cfg(feature = "nu-ansi-term")]
#[cfg(all(feature = "nu-ansi-term", not(feature = "gnu_legacy")))]
#[test]
fn coloring_nu_ansi_term() {
let style = Style {
Expand All @@ -677,7 +673,7 @@ mod tests {
assert_eq!("\x1b[1;34mwow\x1b[0m", nu_ansi.paint("wow").to_string());
}

#[cfg(feature = "nu-ansi-term")]
#[cfg(all(feature = "nu-ansi-term", not(feature = "gnu_legacy")))]
#[test]
fn coloring_nu_ansi_term_with_reset() {
let style = Style {
Expand Down

0 comments on commit 542ca9d

Please sign in to comment.