Skip to content

Commit

Permalink
Remove atty crate dependency
Browse files Browse the repository at this point in the history
This crate seems to be unmaintained. Remove this dependency, as the
functionality seems to work just as well with the standard library call
to is_terminal().

issue reference: softprops/atty#50
  • Loading branch information
ryanfrishkorn committed Aug 20, 2023
1 parent 5a136b2 commit 9ca334c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
25 changes: 2 additions & 23 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 @@ -8,7 +8,6 @@ edition = "2021"
test = false

[dependencies]
atty = "0.2.14"
chrono = "0.4.26"
clap = { version = "4.3.10", features = ["unstable-doc"] }
colored = "2.0.4"
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use rust_stemmers::{Algorithm, Stemmer};
use std::collections::HashMap;
use std::env;
use std::error::Error;
use std::io::Read;
use std::io::{IsTerminal, Read};
use std::path::Path;
use unicode_segmentation::UnicodeSegmentation;
use uuid::Uuid;
Expand Down Expand Up @@ -398,7 +398,7 @@ fn main() -> Result<(), Box<dyn Error>> {
header.add("name", 0, ListHeadingAlignment::Left);

// print listing
if atty::is(atty::Stream::Stdout) {
if std::io::stdout().is_terminal() {
eprintln!("{}", header.build().bright_black());
}
list_items(&conn, header, 0)?;
Expand Down Expand Up @@ -572,7 +572,7 @@ fn main() -> Result<(), Box<dyn Error>> {
limit = v.parse::<usize>()?;
}

if atty::is(atty::Stream::Stdout) {
if std::io::stdout().is_terminal() {
eprintln!("{}", header.build().bright_black());
}
list_items(&conn, header, limit)?;
Expand Down

0 comments on commit 9ca334c

Please sign in to comment.