From ebe96f14549b5bb3dce38811f8b6baf67762ac81 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 11 Jan 2022 13:32:15 +0100 Subject: [PATCH] fold: clap 3 --- src/uu/fold/Cargo.toml | 2 +- src/uu/fold/src/fold.rs | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 5942286ad..600547bda 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/fold.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" } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 30a1012af..31cdf53e0 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -63,16 +63,16 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { fold(files, bytes, spaces, width) } -pub fn uu_app() -> App<'static, 'static> { +pub fn uu_app<'a>() -> App<'a> { App::new(uucore::util_name()) .name(NAME) .version(crate_version!()) - .usage(SYNTAX) + .override_usage(SYNTAX) .about(SUMMARY) .arg( - Arg::with_name(options::BYTES) + Arg::new(options::BYTES) .long(options::BYTES) - .short("b") + .short('b') .help( "count using bytes rather than columns (meaning control characters \ such as newline are not treated specially)", @@ -80,22 +80,26 @@ pub fn uu_app() -> App<'static, 'static> { .takes_value(false), ) .arg( - Arg::with_name(options::SPACES) + Arg::new(options::SPACES) .long(options::SPACES) - .short("s") + .short('s') .help("break lines at word boundaries rather than a hard cut-off") .takes_value(false), ) .arg( - Arg::with_name(options::WIDTH) + Arg::new(options::WIDTH) .long(options::WIDTH) - .short("w") + .short('w') .help("set WIDTH as the maximum line width rather than 80") .value_name("WIDTH") .allow_hyphen_values(true) .takes_value(true), ) - .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::new(options::FILE) + .hide(true) + .multiple_occurrences(true), + ) } fn handle_obsolete(args: &[String]) -> (Vec, Option) {