Skip to content

Commit

Permalink
refactor: replace unmaintained atty (#200)
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxuan Zhang <wenxuangm@gmail.com>
  • Loading branch information
wfxr authored Apr 15, 2024
1 parent a15325d commit d60612b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
21 changes: 0 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ anyhow = "1.0"
unicode-width = "0"
unicode-truncate = "0"
itertools = "0.12"
atty = "0.2"
[target.'cfg(target_family = "unix")'.dependencies]
pager = { version = "0.16", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use cli::App;
use csv::{ErrorKind, ReaderBuilder};
use std::{
fs::File,
io::{self, BufWriter, Read},
io::{self, BufWriter, IsTerminal, Read},
process,
};
use table::TablePrinter;
Expand Down Expand Up @@ -86,7 +86,7 @@ fn try_main() -> anyhow::Result<()> {
.has_headers(!no_headers)
.from_reader(match file {
Some(path) => Box::new(File::open(path)?) as Box<dyn Read>,
None if atty::is(atty::Stream::Stdin) => bail!("no input file specified (use -h for help)"),
None if io::stdin().is_terminal() => bail!("no input file specified (use -h for help)"),
None => Box::new(io::stdin()),
});

Expand Down

0 comments on commit d60612b

Please sign in to comment.