diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-12-13 18:54:09 +0100 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-12-13 19:02:08 +0100 |
commit | dd8b0ef8e12dfc8d7fb8f359f504c63034d60b9f (patch) | |
tree | 219fd19850e715d2ace3f0e48330c86859273223 | |
parent | bbd5c67342f9e5b509b0ab6e9ca2319c3c7605e2 (diff) |
upgrade to clap 4
-rw-r--r-- | Cargo.lock | 104 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 1 | ||||
-rw-r--r-- | src/options.rs | 12 |
4 files changed, 94 insertions, 25 deletions
@@ -14,7 +14,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -48,6 +48,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] +name = "cc" +version = "1.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" + +[[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -55,26 +61,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.23" +version = "4.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d" dependencies = [ - "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", + "is-terminal", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck", "proc-macro-error", @@ -85,9 +89,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] @@ -250,6 +254,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] name = "filesize" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -301,6 +326,15 @@ dependencies = [ ] [[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] name = "idna" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -321,6 +355,28 @@ dependencies = [ ] [[package]] +name = "io-lifetimes" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes", + "rustix", + "windows-sys", +] + +[[package]] name = "itertools" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -346,6 +402,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] +name = "linux-raw-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" + +[[package]] name = "lock_api" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -409,7 +471,7 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] @@ -605,6 +667,20 @@ dependencies = [ ] [[package]] +name = "rustix" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -705,12 +781,6 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - -[[package]] name = "tinyvec" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -18,7 +18,7 @@ tui-shared = ["tui", "tui-react", "open", "unicode-segmentation"] trash-move = ["trash"] [dependencies] -clap = { version = "3.0", features = ["derive"] } +clap = { version = "4.0.29", features = ["derive"] } jwalk = "0.6.0" byte-unit = "4" atty = "0.2.11" diff --git a/src/main.rs b/src/main.rs index 486aee8..a7fd3eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,7 +57,6 @@ fn main() -> Result<()> { let opt: options::Args = options::Args::parse_from(wild::args_os()); let threads = derive_default_threads(opt.threads); - dbg!(threads); let walk_options = dua::WalkOptions { threads, byte_format: opt.format.into(), diff --git a/src/options.rs b/src/options.rs index 727b52a..e618f78 100644 --- a/src/options.rs +++ b/src/options.rs @@ -1,7 +1,7 @@ use dua::ByteFormat as LibraryByteFormat; use std::path::PathBuf; -#[derive(PartialEq, Eq, Debug, Clone, Copy, clap::ArgEnum)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, clap::ValueEnum)] pub enum ByteFormat { Metric, Binary, @@ -50,7 +50,7 @@ pub struct Args { #[clap( short = 'f', long, - arg_enum, + value_enum, default_value_t = ByteFormat::Metric, ignore_case = true, hide_default_value = true, @@ -73,12 +73,12 @@ pub struct Args { /// One or more absolute directories to ignore. Note that these are not ignored if they are passed as input path. /// /// Hence, they will only be ignored if they are eventually reached as part of the traversal. - #[clap(long = "ignore-dirs", short = 'i', parse(from_os_str))] + #[clap(long = "ignore-dirs", short = 'i', value_parser)] #[cfg_attr(target_os = "linux", clap(default_values = &["/proc", "/dev", "/sys", "/run"]))] pub ignore_dirs: Vec<PathBuf>, /// One or more input files or directories. If unset, we will use all entries in the current working directory. - #[clap(parse(from_os_str))] + #[clap(value_parser)] pub input: Vec<PathBuf>, } @@ -89,7 +89,7 @@ pub enum Command { #[clap(name = "interactive", visible_alias = "i")] Interactive { /// One or more input files or directories. If unset, we will use all entries in the current working directory. - #[clap(parse(from_os_str))] + #[clap(value_parser)] input: Vec<PathBuf>, }, /// Aggregrate the consumed space of one or more directories or files @@ -106,7 +106,7 @@ pub enum Command { #[clap(long)] no_total: bool, /// One or more input files or directories. If unset, we will use all entries in the current working directory. - #[clap(parse(from_os_str))] + #[clap(value_parser)] input: Vec<PathBuf>, }, } |