From 57361292aa053ca80f2ede7c8c0974c0b5e42369 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 11 Jan 2022 14:55:13 +0100 Subject: [PATCH] sync: clap 3 --- src/uu/sync/Cargo.toml | 2 +- src/uu/sync/src/sync.rs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index d0fa6bcdc..695e3d40f 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/sync.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", features=["wide"] } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 4e6bb7d27..c6416ce5b 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -165,7 +165,7 @@ fn usage() -> String { pub fn uumain(args: impl uucore::Args) -> UResult<()> { let usage = usage(); - let matches = uu_app().usage(&usage[..]).get_matches_from(args); + let matches = uu_app().override_usage(&usage[..]).get_matches_from(args); let files: Vec = matches .values_of(ARG_FILES) @@ -194,25 +194,29 @@ 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::FILE_SYSTEM) - .short("f") + Arg::new(options::FILE_SYSTEM) + .short('f') .long(options::FILE_SYSTEM) .conflicts_with(options::DATA) .help("sync the file systems that contain the files (Linux and Windows only)"), ) .arg( - Arg::with_name(options::DATA) - .short("d") + Arg::new(options::DATA) + .short('d') .long(options::DATA) .conflicts_with(options::FILE_SYSTEM) .help("sync only file data, no unneeded metadata (Linux only)"), ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) + .arg( + Arg::new(ARG_FILES) + .multiple_occurrences(true) + .takes_value(true), + ) } fn sync() -> isize {