Skip to content

Commit

Permalink
remove atty
Browse files Browse the repository at this point in the history
  • Loading branch information
jRimbault committed Jul 30, 2024
1 parent 9f2a2ce commit 386cd7e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 50 deletions.
45 changes: 1 addition & 44 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ default = ["build-bin"]
build-bin = [
"ahash",
"anyhow",
"atty",
"byte-unit",
"clap",
"clap-verbosity-flag",
Expand Down Expand Up @@ -54,7 +53,6 @@ typed-builder = "0.19.1"
# binary dependencies
ahash = { version = "0.8.10", optional = true }
anyhow = { version = "1.0.38", optional = true }
atty = { version = "0.2.14", optional = true }
byte-unit = { version = "5.1.4", features = ["byte"], optional = true }
clap = { version = "4.4.14", features = ["cargo", "derive", "string"], optional = true }
clap-verbosity-flag = { version = "2.1.1", optional = true }
Expand Down
9 changes: 5 additions & 4 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ fn init_logger(verbosity: &clap_verbosity_flag::Verbosity) {
}

fn default_paths() -> Vec<PathBuf> {
let mut paths = if atty::isnt(atty::Stream::Stdin) {
std::io::stdin()
let stdin = std::io::stdin();
let mut paths = if std::io::IsTerminal::is_terminal(&stdin) {
Vec::new()
} else {
stdin
.lock()
.lines()
.map_while(Result::ok)
.map(Into::into)
.collect()
} else {
Vec::new()
};
if paths.is_empty() {
paths.push(env::current_dir().expect("couldn't get current working directory"));
Expand Down

0 comments on commit 386cd7e

Please sign in to comment.