From 83f39619d5d34165f2b892f9ebf8768c0df12d07 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Tue, 11 Jan 2022 13:50:05 +0100 Subject: [PATCH] kill: clap 3 --- src/uu/kill/Cargo.toml | 2 +- src/uu/kill/src/kill.rs | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 452b0f407..a389b9924 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/kill.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=["signals"] } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index e9b7ee349..a1a456c84 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -43,7 +43,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let obs_signal = handle_obsolete(&mut args); let usage = format!("{} [OPTIONS]... PID...", uucore::execution_phrase()); - let matches = uu_app().usage(&usage[..]).get_matches_from(args); + let matches = uu_app().override_usage(&usage[..]).get_matches_from(args); let mode = if matches.is_present(options::TABLE) || matches.is_present(options::TABLE_OLD) { Mode::Table @@ -78,36 +78,36 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } } -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::LIST) - .short("l") + Arg::new(options::LIST) + .short('l') .long(options::LIST) .help("Lists signals") .conflicts_with(options::TABLE) .conflicts_with(options::TABLE_OLD), ) .arg( - Arg::with_name(options::TABLE) - .short("t") + Arg::new(options::TABLE) + .short('t') .long(options::TABLE) .help("Lists table of signals"), ) - .arg(Arg::with_name(options::TABLE_OLD).short("L").hidden(true)) + .arg(Arg::new(options::TABLE_OLD).short('L').hide(true)) .arg( - Arg::with_name(options::SIGNAL) - .short("s") + Arg::new(options::SIGNAL) + .short('s') .long(options::SIGNAL) .help("Sends given signal") .takes_value(true), ) .arg( - Arg::with_name(options::PIDS_OR_SIGNALS) - .hidden(true) - .multiple(true), + Arg::new(options::PIDS_OR_SIGNALS) + .hide(true) + .multiple_occurrences(true), ) }