From 740edeb73f355a68b09bc43c3aed2a7a10572f2d Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Thu, 8 Jun 2023 00:10:53 -0600 Subject: [PATCH] Replace atty with std std now has a function for testing if stdout is a tty --- Cargo.lock | 21 --------------------- Cargo.toml | 1 - src/main.rs | 4 ++-- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39ef478..ce96021 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,17 +37,6 @@ dependencies = [ "nix 0.24.3", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -327,7 +316,6 @@ version = "8.7.0" dependencies = [ "anyhow", "argmax", - "atty", "chrono", "clap", "clap_complete", @@ -403,15 +391,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.2.6" diff --git a/Cargo.toml b/Cargo.toml index 3746c26..0726657 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ version_check = "0.9" [dependencies] nu-ansi-term = "0.47" argmax = "0.3.1" -atty = "0.2" ignore = "0.4.20" num_cpus = "1.15" regex = "1.7.3" diff --git a/src/main.rs b/src/main.rs index eca1ad7..8c39a1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,12 +12,12 @@ mod regex_helper; mod walk; use std::env; +use std::io::IsTerminal; use std::path::Path; use std::sync::Arc; use std::time; use anyhow::{anyhow, bail, Context, Result}; -use atty::Stream; use clap::{CommandFactory, Parser}; use globset::GlobBuilder; use lscolors::LsColors; @@ -217,7 +217,7 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result true, ColorWhen::Never => false,