1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

mkfifo: update to clap 4

This commit is contained in:
Terts Diepraam 2022-09-29 22:10:12 +02:00
parent 67ba0c8195
commit d509c16a22
2 changed files with 8 additions and 7 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/mkfifo.rs" path = "src/mkfifo.rs"
[dependencies] [dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] } clap = { version = "4.0", features = ["wrap_help", "cargo"] }
libc = "0.2.135" libc = "0.2.135"
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" } uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }

View file

@ -8,7 +8,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, Arg, Command}; use clap::{crate_version, Arg, ArgAction, Command};
use libc::mkfifo; use libc::mkfifo;
use std::ffi::CString; use std::ffi::CString;
use uucore::display::Quotable; use uucore::display::Quotable;
@ -35,7 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
if matches.contains_id(options::CONTEXT) { if matches.contains_id(options::CONTEXT) {
return Err(USimpleError::new(1, "--context is not implemented")); 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")); return Err(USimpleError::new(1, "-Z is not implemented"));
} }
@ -68,7 +68,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
@ -81,12 +81,13 @@ pub fn uu_app<'a>() -> Command<'a> {
.long(options::MODE) .long(options::MODE)
.help("file permissions for the fifo") .help("file permissions for the fifo")
.default_value("0666") .default_value("0666")
.value_name("0666"), .value_name("MODE"),
) )
.arg( .arg(
Arg::new(options::SE_LINUX_SECURITY_CONTEXT) Arg::new(options::SE_LINUX_SECURITY_CONTEXT)
.short('Z') .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(
Arg::new(options::CONTEXT) Arg::new(options::CONTEXT)
@ -100,7 +101,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.arg( .arg(
Arg::new(options::FIFO) Arg::new(options::FIFO)
.hide(true) .hide(true)
.multiple_occurrences(true) .action(ArgAction::Append)
.value_hint(clap::ValueHint::AnyPath), .value_hint(clap::ValueHint::AnyPath),
) )
} }