mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-19 04:21:06 +00:00
Merge pull request #2530 from nickelc/deps/use_is_terminal
Use the `is-terminal` crate instead of `atty`
This commit is contained in:
commit
c5731b9079
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -69,7 +69,6 @@ version = "0.23.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_colours",
|
"ansi_colours",
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
"atty",
|
|
||||||
"bincode",
|
"bincode",
|
||||||
"bugreport",
|
"bugreport",
|
||||||
"bytesize",
|
"bytesize",
|
||||||
@ -84,6 +83,7 @@ dependencies = [
|
|||||||
"git2",
|
"git2",
|
||||||
"globset",
|
"globset",
|
||||||
"grep-cli",
|
"grep-cli",
|
||||||
|
"is-terminal",
|
||||||
"nix",
|
"nix",
|
||||||
"nu-ansi-term",
|
"nu-ansi-term",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -25,7 +25,7 @@ application = [
|
|||||||
# Mainly for developers that want to iterate quickly
|
# Mainly for developers that want to iterate quickly
|
||||||
# Be aware that the included features might change in the future
|
# Be aware that the included features might change in the future
|
||||||
minimal-application = [
|
minimal-application = [
|
||||||
"atty",
|
"is-terminal",
|
||||||
"clap",
|
"clap",
|
||||||
"dirs",
|
"dirs",
|
||||||
"paging",
|
"paging",
|
||||||
@ -41,7 +41,7 @@ regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
|||||||
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atty = { version = "0.2.14", optional = true }
|
is-terminal = { version = "0.4.4", optional = true }
|
||||||
nu-ansi-term = "0.47.0"
|
nu-ansi-term = "0.47.0"
|
||||||
ansi_colours = "^1.2"
|
ansi_colours = "^1.2"
|
||||||
bincode = "1.0"
|
bincode = "1.0"
|
||||||
|
@ -2,7 +2,7 @@ use std::collections::HashSet;
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use atty::{self, Stream};
|
use is_terminal::IsTerminal;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
clap_app,
|
clap_app,
|
||||||
@ -40,7 +40,7 @@ impl App {
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
let _ = nu_ansi_term::enable_ansi_support();
|
let _ = nu_ansi_term::enable_ansi_support();
|
||||||
|
|
||||||
let interactive_output = atty::is(Stream::Stdout);
|
let interactive_output = std::io::stdout().is_terminal();
|
||||||
|
|
||||||
Ok(App {
|
Ok(App {
|
||||||
matches: Self::matches(interactive_output)?,
|
matches: Self::matches(interactive_output)?,
|
||||||
@ -104,7 +104,7 @@ impl App {
|
|||||||
// If we are reading from stdin, only enable paging if we write to an
|
// If we are reading from stdin, only enable paging if we write to an
|
||||||
// interactive terminal and if we do not *read* from an interactive
|
// interactive terminal and if we do not *read* from an interactive
|
||||||
// terminal.
|
// terminal.
|
||||||
if self.interactive_output && !atty::is(Stream::Stdin) {
|
if self.interactive_output && std::io::stdin().is_terminal() {
|
||||||
PagingMode::QuitIfOneScreen
|
PagingMode::QuitIfOneScreen
|
||||||
} else {
|
} else {
|
||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
|
Loading…
x
Reference in New Issue
Block a user