From 031bde97bf22cd4728784b44d92aa227a3fb43dd Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 11 Jan 2022 12:20:38 +0100 Subject: [PATCH] base32: clap 3 --- src/uu/base32/Cargo.toml | 2 +- src/uu/base32/src/base32.rs | 2 +- src/uu/base32/src/base_common.rs | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 879051a42..280a4329d 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/base32.rs" [dependencies] -clap = { version = "2.33", features = ["wrap_help"] } +clap = { version = "3.0", features = ["wrap_help", "cargo"] } uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index f4b4b49de..329a4ec84 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -47,6 +47,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { ) } -pub fn uu_app() -> App<'static, 'static> { +pub fn uu_app<'a>() -> App<'a> { base_common::base_app(ABOUT) } diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index b07203507..7dd4ce76b 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -86,33 +86,33 @@ impl Config { } pub fn parse_base_cmd_args(args: impl uucore::Args, about: &str, usage: &str) -> UResult { - let app = base_app(about).usage(usage); + let app = base_app(about).override_usage(usage); let arg_list = args .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); Config::from(&app.get_matches_from(arg_list)) } -pub fn base_app<'a>(about: &'a str) -> App<'static, 'a> { +pub fn base_app(about: &str) -> App { App::new(uucore::util_name()) .version(crate_version!()) .about(about) // Format arguments. .arg( - Arg::with_name(options::DECODE) - .short("d") + Arg::new(options::DECODE) + .short('d') .long(options::DECODE) .help("decode data"), ) .arg( - Arg::with_name(options::IGNORE_GARBAGE) - .short("i") + Arg::new(options::IGNORE_GARBAGE) + .short('i') .long(options::IGNORE_GARBAGE) .help("when decoding, ignore non-alphabetic characters"), ) .arg( - Arg::with_name(options::WRAP) - .short("w") + Arg::new(options::WRAP) + .short('w') .long(options::WRAP) .takes_value(true) .help( @@ -121,7 +121,7 @@ pub fn base_app<'a>(about: &'a str) -> App<'static, 'a> { ) // "multiple" arguments are used to check whether there is more than one // file passed in. - .arg(Arg::with_name(options::FILE).index(1).multiple(true)) + .arg(Arg::new(options::FILE).index(1).multiple_occurrences(true)) } pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult> {