Skip to content

Commit

Permalink
feat: use std's is_terminal()
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvisCraft authored and ctron committed Nov 15, 2023
1 parent cb3a340 commit 3ec8713
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "4.0.0"
edition = "2021"
authors = ["Jens Reimann <[email protected]>", "Harald Hoyer <[email protected]>"]
description = "Colorize JSON, for printing it out on the command line"
rust-version = "1.70.0"

homepage = "https://github.com/ctron/colored_json"
repository = "https://github.com/ctron/colored_json"
Expand All @@ -16,10 +17,9 @@ categories = ["command-line-interface", "encoding", "visualization"]
license = "EPL-2.0"

[dependencies]
is-terminal = "0.4.4"
serde = "1"
serde_json = "1"
yansi = "0.5"

[dev-dependencies]
serde = { version = "1", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,11 @@
//! # }
//!```
use is_terminal::IsTerminal;
use serde::Serialize;
use serde_json::ser::Formatter;
pub use serde_json::ser::{CompactFormatter, PrettyFormatter};
use serde_json::value::Value;
use std::io;
use std::io::{self, IsTerminal};

pub use yansi::{Color, Style};

Expand Down Expand Up @@ -763,8 +762,8 @@ pub enum Output {
impl ColorMode {
fn is_tty(output: Output) -> bool {
match output {
Output::StdOut => std::io::stdout().is_terminal(),
Output::StdErr => std::io::stderr().is_terminal(),
Output::StdOut => io::stdout().is_terminal(),
Output::StdErr => io::stderr().is_terminal(),
}
}

Expand Down

0 comments on commit 3ec8713

Please sign in to comment.