diff options
author | andy.boot <bootandy@gmail.com> | 2023-11-09 21:52:13 +0000 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2023-11-09 23:23:05 +0000 |
commit | 7c54d41aced6063c3a0472e614a8b77ef0a6a3e6 (patch) | |
tree | f30d06e7bc069f11f832b2cea3729fc8f2f21e99 | |
parent | 2fa14ca19cd80ba2be106784e2626b64b199e61b (diff) |
dependency: remove atty
Read input from clap
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/main.rs | 17 |
3 files changed, 1 insertions, 18 deletions
@@ -218,7 +218,6 @@ version = "0.8.6" dependencies = [ "ansi_term", "assert_cmd", - "atty", "clap", "clap_complete", "clap_mangen", @@ -28,7 +28,6 @@ strip = true [dependencies] ansi_term = "0.12" -atty = "0.2.14" clap = "3.2.17" lscolors = "0.13" terminal_size = "0.2" diff --git a/src/main.rs b/src/main.rs index fb1420b..998fd31 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,6 @@ use filter::AggregateData; use progress::PIndicator; use progress::ORDERING; use std::collections::HashSet; -use std::io::BufRead; use std::panic; use std::process; use sysinfo::{System, SystemExt}; @@ -99,27 +98,13 @@ fn get_regex_value(maybe_value: Option<Values>) -> Vec<Regex> { .collect() } -// Returns a list of lines from stdin or `None` if there's nothing to read -fn get_lines_from_stdin() -> Option<Vec<String>> { - atty::isnt(atty::Stream::Stdin).then(|| { - std::io::stdin() - .lock() - .lines() - .collect::<Result<_, _>>() - .expect("Error reading from stdin") - }) -} - fn main() { let options = build_cli().get_matches(); let config = get_config(); - let stdin_lines = get_lines_from_stdin(); let target_dirs = match options.values_of("inputs") { Some(values) => values.collect(), - None => stdin_lines.as_ref().map_or(vec!["."], |lines| { - lines.iter().map(String::as_str).collect() - }), + None => vec!["."], }; let summarize_file_types = options.is_present("types"); |