diff --git a/Cargo.lock b/Cargo.lock index 74e74b8..bf1a948 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,7 +107,6 @@ name = "sg" version = "0.1.0" dependencies = [ "ansi_term", - "atty", "cc", "clap", "rustc_tools_util", diff --git a/Cargo.toml b/Cargo.toml index 9cc9d7b..0efeb67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,6 @@ repository = "https://github.com/osa1/sg" [dependencies] ansi_term = "0.12" -atty = "0.2.14" clap = "2.33" tree-sitter = "0.20.6" diff --git a/src/main.rs b/src/main.rs index 53c6941..7a06bf1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use std::borrow::Cow; use std::cell::RefCell; use std::ffi::OsString; use std::fs; -use std::io::Write; +use std::io::{IsTerminal, Write}; use std::path::Path; use tree_sitter::{Language, Node, Parser}; @@ -122,7 +122,7 @@ where } }; - if !nocolor && !assume_color_support && !atty::is(atty::Stream::Stdout) { + if !nocolor && !assume_color_support && !std::io::stdout().is_terminal() { nocolor = true; }