Skip to content

Commit

Permalink
chore: replace atty with is-terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
jcgruenhage committed Sep 22, 2022
1 parent 0380d8d commit 8b03c49
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
31 changes: 28 additions & 3 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ unstable-doc = ["derive", "cargo", "wrap_help", "env", "unicode", "string", "uns

# Used in default
std = [] # support for no_std in a backwards-compatible way
color = ["dep:atty", "dep:termcolor"]
color = ["dep:is-terminal", "dep:termcolor"]
help = []
usage = []
error-context = []
Expand Down Expand Up @@ -96,7 +96,7 @@ clap_lex = { path = "./clap_lex", version = "0.3.0" }
bitflags = "1.2"
unicase = { version = "2.6", optional = true }
strsim = { version = "0.10", optional = true }
atty = { version = "0.2", optional = true }
is-terminal = { version = "0.3", optional = true }
termcolor = { version = "1.1.1", optional = true }
terminal_size = { version = "0.2.1", optional = true }
backtrace = { version = "0.3", optional = true }
Expand Down
11 changes: 5 additions & 6 deletions src/output/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ impl std::fmt::Display for Colorizer {

#[cfg(feature = "color")]
fn is_a_tty(stream: Stream) -> bool {
let stream = match stream {
Stream::Stdout => atty::Stream::Stdout,
Stream::Stderr => atty::Stream::Stderr,
};

atty::is(stream)
use is_terminal::IsTerminal;
match stream {
Stream::Stdout => std::io::stdout().is_terminal(),
Stream::Stderr => std::io::stderr().is_terminal(),
}
}

0 comments on commit 8b03c49

Please sign in to comment.