diff --git a/Cargo.toml b/Cargo.toml index 49117e7..c51d82f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "findlargedir" -version = "0.6.2" +version = "0.6.3" authors = ["Dinko Korunic "] categories = ["command-line-utilities"] description = "find all blackhole directories with a huge amount of filesystem entries in a flat structure" @@ -12,19 +12,18 @@ edition = "2021" [dependencies] jwalk = "0.8.1" -rayon = "1.8.0" -num_cpus = "1.16.0" -tempfile = "3.9.0" +rayon = "1.8.1" +tempfile = "3.10.0" anyhow = "1.0.79" human_format = "1.0.3" human_bytes = { version = "0.4.3", features = ["fast"] } humantime = "2.1.0" -clap = { version = "4.4.13", features = ["derive"] } +clap = { version = "4.5.1", features = ["derive"] } ctrlc = { version = "3.4.2", features = ["termination"] } rm_rf = "0.6.2" ansi_term = "0.12.1" fs-err = "2.11.0" -indicatif = { version = "0.17.7", features = ["rayon"] } +indicatif = { version = "0.17.8", features = ["rayon"] } cfg-if = "1.0" fdlimit = "0.3.0" diff --git a/src/args.rs b/src/args.rs index 11405bf..927492c 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,4 +1,5 @@ use std::path::PathBuf; +use std::thread; use anyhow::{anyhow, Error}; use clap::builder::ValueParser; @@ -29,7 +30,7 @@ pub struct Args { pub blacklist_threshold: u64, /// Number of threads to use when calibrating and scanning - #[clap(short = 'x', long, value_parser = ValueParser::new(parse_threads), default_value_t = num_cpus::get())] + #[clap(short = 'x', long, value_parser = ValueParser::new(parse_threads), default_value_t = thread::available_parallelism().map(| n | n.get()).unwrap_or(1))] pub threads: usize, /// Seconds between status updates, set to 0 to disable diff --git a/src/main.rs b/src/main.rs index c3da88e..d74e050 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,18 +1,18 @@ #![warn(clippy::all, clippy::pedantic)] -use anyhow::{Context, Error, Result}; -use cfg_if::cfg_if; -use clap::Parser; -use fdlimit::{raise_fd_limit, Outcome}; -use humantime::Duration as HumanDuration; use std::collections::HashSet; use std::os::unix::fs::MetadataExt; use std::sync::atomic::AtomicBool; use std::sync::Arc; use std::time::Instant; -use tempfile::TempDir; +use anyhow::{Context, Error, Result}; +use cfg_if::cfg_if; +use clap::Parser; +use fdlimit::{raise_fd_limit, Outcome}; use fs_err as fs; +use humantime::Duration as HumanDuration; +use tempfile::TempDir; mod args; mod calibrate;