Skip to content

Commit

Permalink
fix(stream): Correctly handle both CLICOLOR cases
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Mar 13, 2023
1 parent 102e8ac commit 310aa0d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/anstyle-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ anstyle = { version = "0.3.0", path = "../anstyle" }
anstyle-parse = { version = "0.1.0", path = "../anstyle-parse" }
anstyle-wincon = { version = "0.1.0", path = "../anstyle-wincon", optional = true }
concolor-override = { version = "1.0.0", optional = true }
concolor-query = { version = "0.2.0", optional = true }
concolor-query = { version = "0.3.0", optional = true }
is-terminal = { version = "0.4.4", optional = true }
utf8parse = "0.2.1"

Expand Down
7 changes: 5 additions & 2 deletions crates/anstyle-stream/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ where
pub fn new(raw: S, choice: ColorChoice) -> Self {
match choice {
ColorChoice::Auto => {
let clicolor = concolor_query::clicolor();
let clicolor_enabled = clicolor.unwrap_or(false);
let clicolor_disabled = !clicolor.unwrap_or(true);
if raw.is_terminal()
&& !concolor_query::no_color()
&& concolor_query::term_supports_color()
&& concolor_query::clicolor()
&& !clicolor_disabled
&& (concolor_query::term_supports_color() || clicolor_enabled)
|| concolor_query::clicolor_force()
{
Self::always(raw)
Expand Down

0 comments on commit 310aa0d

Please sign in to comment.