From 4b574d62281d9407c66f66f93406d92c917cafde Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 29 Sep 2022 23:04:32 +0200 Subject: [PATCH] nl: update to clap 4 --- src/uu/nl/Cargo.toml | 2 +- src/uu/nl/src/nl.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 887f306bf..5cb5f7bb9 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -15,7 +15,7 @@ edition = "2021" path = "src/nl.rs" [dependencies] -clap = { version = "3.2", features = ["wrap_help", "cargo"] } +clap = { version = "4.0", features = ["wrap_help", "cargo"] } regex = "1.6.0" uucore = { version=">=0.0.16", package="uucore", path="../../uucore" } diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index f754ca1a3..451f77048 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -8,7 +8,7 @@ // spell-checker:ignore (ToDO) corasick memchr -use clap::{crate_version, Arg, Command}; +use clap::{crate_version, Arg, ArgAction, Command}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; @@ -139,22 +139,24 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { Ok(()) } -pub fn uu_app<'a>() -> Command<'a> { +pub fn uu_app() -> Command { Command::new(uucore::util_name()) .name(NAME) .about(ABOUT) .version(crate_version!()) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .disable_help_flag(true) .arg( Arg::new(options::HELP) .long(options::HELP) - .help("Print help information."), + .help("Print help information.") + .action(ArgAction::Help), ) .arg( Arg::new(options::FILE) .hide(true) - .multiple_occurrences(true) + .action(ArgAction::Append) .value_hint(clap::ValueHint::FilePath), ) .arg(