From 49b19972ccff98a5163abdf155554b6449f1cdbd Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 11 Jan 2022 14:24:16 +0100 Subject: [PATCH] pathchk: clap 3 --- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pathchk/src/pathchk.rs | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 22a5bf63d..481c1679e 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/pathchk.rs" [dependencies] -clap = { version = "2.33", features = ["wrap_help"] } +clap = { version = "3.0", features = ["wrap_help", "cargo"] } libc = "0.2.42" uucore = { version=">=0.0.10", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index fa6aaad5b..0ef2ddc90 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -47,7 +47,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = uu_app().usage(&usage[..]).get_matches_from(args); + let matches = uu_app().override_usage(&usage[..]).get_matches_from(args); // set working mode let is_posix = matches.values_of(options::POSIX).is_some(); @@ -88,26 +88,30 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { Ok(()) } -pub fn uu_app() -> App<'static, 'static> { +pub fn uu_app<'a>() -> App<'a> { App::new(uucore::util_name()) .version(crate_version!()) .about(ABOUT) .arg( - Arg::with_name(options::POSIX) - .short("p") + Arg::new(options::POSIX) + .short('p') .help("check for most POSIX systems"), ) .arg( - Arg::with_name(options::POSIX_SPECIAL) - .short("P") + Arg::new(options::POSIX_SPECIAL) + .short('P') .help(r#"check for empty names and leading "-""#), ) .arg( - Arg::with_name(options::PORTABILITY) + Arg::new(options::PORTABILITY) .long(options::PORTABILITY) .help("check for all POSIX systems (equivalent to -p -P)"), ) - .arg(Arg::with_name(options::PATH).hidden(true).multiple(true)) + .arg( + Arg::new(options::PATH) + .hide(true) + .multiple_occurrences(true), + ) } // check a path, given as a slice of it's components and an operating mode