From 449a536c592ec91a532f4e2d7a23fbc3d603c10d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 11 Jan 2022 13:28:05 +0100 Subject: [PATCH] expand: clap 3 --- src/uu/expand/Cargo.toml | 2 +- src/uu/expand/src/expand.rs | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 18f800985..db7bdf74a 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/expand.rs" [dependencies] -clap = { version = "2.33", features = ["wrap_help"] } +clap = { version = "3.0", features = ["wrap_help", "cargo"] } unicode-width = "0.1.5" 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/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 425179092..8528593f9 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -174,39 +174,39 @@ impl Options { #[uucore_procs::gen_uumain] 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); expand(Options::new(&matches)).map_err_context(|| "failed to write output".to_string()) } -pub fn uu_app() -> App<'static, 'static> { +pub fn uu_app<'a>() -> App<'a> { App::new(uucore::util_name()) .version(crate_version!()) .about(ABOUT) .after_help(LONG_HELP) .arg( - Arg::with_name(options::INITIAL) + Arg::new(options::INITIAL) .long(options::INITIAL) - .short("i") + .short('i') .help("do not convert tabs after non blanks"), ) .arg( - Arg::with_name(options::TABS) + Arg::new(options::TABS) .long(options::TABS) - .short("t") + .short('t') .value_name("N, LIST") .takes_value(true) .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), ) .arg( - Arg::with_name(options::NO_UTF8) + Arg::new(options::NO_UTF8) .long(options::NO_UTF8) - .short("U") + .short('U') .help("interpret input file as 8-bit ASCII rather than UTF-8"), ).arg( - Arg::with_name(options::FILES) - .multiple(true) - .hidden(true) + Arg::new(options::FILES) + .multiple_occurrences(true) + .hide(true) .takes_value(true) ) }