mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-02 11:22:30 +01:00
Use the is-terminal
crate instead of atty
The crate is already used by `clap` and a similar trait is about to be stabilized in `std`.
This commit is contained in:
@@ -2,7 +2,7 @@ use std::collections::HashSet;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use atty::{self, Stream};
|
||||
use is_terminal::IsTerminal;
|
||||
|
||||
use crate::{
|
||||
clap_app,
|
||||
@@ -40,7 +40,7 @@ impl App {
|
||||
#[cfg(windows)]
|
||||
let _ = nu_ansi_term::enable_ansi_support();
|
||||
|
||||
let interactive_output = atty::is(Stream::Stdout);
|
||||
let interactive_output = std::io::stdout().is_terminal();
|
||||
|
||||
Ok(App {
|
||||
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
|
||||
// interactive terminal and if we do not *read* from an interactive
|
||||
// terminal.
|
||||
if self.interactive_output && !atty::is(Stream::Stdin) {
|
||||
if self.interactive_output && std::io::stdin().is_terminal() {
|
||||
PagingMode::QuitIfOneScreen
|
||||
} else {
|
||||
PagingMode::Never
|
||||
|
Reference in New Issue
Block a user