mirror of https://github.com/sharkdp/fd.git
Replace atty with std
std now has a function for testing if stdout is a tty
This commit is contained in:
parent
91e3c3cba5
commit
740edeb73f
|
@ -37,17 +37,6 @@ dependencies = [
|
||||||
"nix 0.24.3",
|
"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]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
@ -327,7 +316,6 @@ version = "8.7.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"argmax",
|
"argmax",
|
||||||
"atty",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
|
@ -403,15 +391,6 @@ version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
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]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
|
|
|
@ -36,7 +36,6 @@ version_check = "0.9"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nu-ansi-term = "0.47"
|
nu-ansi-term = "0.47"
|
||||||
argmax = "0.3.1"
|
argmax = "0.3.1"
|
||||||
atty = "0.2"
|
|
||||||
ignore = "0.4.20"
|
ignore = "0.4.20"
|
||||||
num_cpus = "1.15"
|
num_cpus = "1.15"
|
||||||
regex = "1.7.3"
|
regex = "1.7.3"
|
||||||
|
|
|
@ -12,12 +12,12 @@ mod regex_helper;
|
||||||
mod walk;
|
mod walk;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::io::IsTerminal;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time;
|
use std::time;
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Context, Result};
|
use anyhow::{anyhow, bail, Context, Result};
|
||||||
use atty::Stream;
|
|
||||||
use clap::{CommandFactory, Parser};
|
use clap::{CommandFactory, Parser};
|
||||||
use globset::GlobBuilder;
|
use globset::GlobBuilder;
|
||||||
use lscolors::LsColors;
|
use lscolors::LsColors;
|
||||||
|
@ -217,7 +217,7 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result<Config
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
let ansi_colors_support = true;
|
let ansi_colors_support = true;
|
||||||
|
|
||||||
let interactive_terminal = atty::is(Stream::Stdout);
|
let interactive_terminal = std::io::stdout().is_terminal();
|
||||||
let colored_output = match opts.color {
|
let colored_output = match opts.color {
|
||||||
ColorWhen::Always => true,
|
ColorWhen::Always => true,
|
||||||
ColorWhen::Never => false,
|
ColorWhen::Never => false,
|
||||||
|
|
Loading…
Reference in New Issue