From d509c16a220528e4b27b9073eace295aaf1348a7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 29 Sep 2022 22:10:12 +0200 Subject: [PATCH] mkfifo: update to clap 4 --- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mkfifo/src/mkfifo.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 25912ccbc..f932697ff 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -15,7 +15,7 @@ edition = "2021" path = "src/mkfifo.rs" [dependencies] -clap = { version = "3.2", features = ["wrap_help", "cargo"] } +clap = { version = "4.0", features = ["wrap_help", "cargo"] } libc = "0.2.135" uucore = { version=">=0.0.16", package="uucore", path="../../uucore" } diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 4e82d95ab..33344a6f2 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -8,7 +8,7 @@ #[macro_use] extern crate uucore; -use clap::{crate_version, Arg, Command}; +use clap::{crate_version, Arg, ArgAction, Command}; use libc::mkfifo; use std::ffi::CString; use uucore::display::Quotable; @@ -35,7 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { if matches.contains_id(options::CONTEXT) { return Err(USimpleError::new(1, "--context is not implemented")); } - if matches.contains_id(options::SE_LINUX_SECURITY_CONTEXT) { + if matches.get_flag(options::SE_LINUX_SECURITY_CONTEXT) { return Err(USimpleError::new(1, "-Z is not implemented")); } @@ -68,7 +68,7 @@ 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) .version(crate_version!()) @@ -81,12 +81,13 @@ pub fn uu_app<'a>() -> Command<'a> { .long(options::MODE) .help("file permissions for the fifo") .default_value("0666") - .value_name("0666"), + .value_name("MODE"), ) .arg( Arg::new(options::SE_LINUX_SECURITY_CONTEXT) .short('Z') - .help("set the SELinux security context to default type"), + .help("set the SELinux security context to default type") + .action(ArgAction::SetTrue), ) .arg( Arg::new(options::CONTEXT) @@ -100,7 +101,7 @@ pub fn uu_app<'a>() -> Command<'a> { .arg( Arg::new(options::FIFO) .hide(true) - .multiple_occurrences(true) + .action(ArgAction::Append) .value_hint(clap::ValueHint::AnyPath), ) }