Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd8b0ef

Browse files
committed
upgrade to clap 4
1 parent bbd5c67 commit dd8b0ef

4 files changed

Lines changed: 94 additions & 25 deletions

File tree

Cargo.lock

Lines changed: 87 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ tui-shared = ["tui", "tui-react", "open", "unicode-segmentation"]
1818
trash-move = ["trash"]
1919

2020
[dependencies]
21-
clap = { version = "3.0", features = ["derive"] }
21+
clap = { version = "4.0.29", features = ["derive"] }
2222
jwalk = "0.6.0"
2323
byte-unit = "4"
2424
atty = "0.2.11"

src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ fn main() -> Result<()> {
5757

5858
let opt: options::Args = options::Args::parse_from(wild::args_os());
5959
let threads = derive_default_threads(opt.threads);
60-
dbg!(threads);
6160
let walk_options = dua::WalkOptions {
6261
threads,
6362
byte_format: opt.format.into(),

src/options.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use dua::ByteFormat as LibraryByteFormat;
22
use std::path::PathBuf;
33

4-
#[derive(PartialEq, Eq, Debug, Clone, Copy, clap::ArgEnum)]
4+
#[derive(PartialEq, Eq, Debug, Clone, Copy, clap::ValueEnum)]
55
pub enum ByteFormat {
66
Metric,
77
Binary,
@@ -50,7 +50,7 @@ pub struct Args {
5050
#[clap(
5151
short = 'f',
5252
long,
53-
arg_enum,
53+
value_enum,
5454
default_value_t = ByteFormat::Metric,
5555
ignore_case = true,
5656
hide_default_value = true,
@@ -73,12 +73,12 @@ pub struct Args {
7373
/// One or more absolute directories to ignore. Note that these are not ignored if they are passed as input path.
7474
///
7575
/// Hence, they will only be ignored if they are eventually reached as part of the traversal.
76-
#[clap(long = "ignore-dirs", short = 'i', parse(from_os_str))]
76+
#[clap(long = "ignore-dirs", short = 'i', value_parser)]
7777
#[cfg_attr(target_os = "linux", clap(default_values = &["/proc", "/dev", "/sys", "/run"]))]
7878
pub ignore_dirs: Vec<PathBuf>,
7979

8080
/// One or more input files or directories. If unset, we will use all entries in the current working directory.
81-
#[clap(parse(from_os_str))]
81+
#[clap(value_parser)]
8282
pub input: Vec<PathBuf>,
8383
}
8484

@@ -89,7 +89,7 @@ pub enum Command {
8989
#[clap(name = "interactive", visible_alias = "i")]
9090
Interactive {
9191
/// One or more input files or directories. If unset, we will use all entries in the current working directory.
92-
#[clap(parse(from_os_str))]
92+
#[clap(value_parser)]
9393
input: Vec<PathBuf>,
9494
},
9595
/// Aggregrate the consumed space of one or more directories or files
@@ -106,7 +106,7 @@ pub enum Command {
106106
#[clap(long)]
107107
no_total: bool,
108108
/// One or more input files or directories. If unset, we will use all entries in the current working directory.
109-
#[clap(parse(from_os_str))]
109+
#[clap(value_parser)]
110110
input: Vec<PathBuf>,
111111
},
112112
}

0 commit comments

Comments
 (0)