mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
kill: update to clap 4
This commit is contained in:
parent
879a9bec29
commit
6eb7c64f7a
2 changed files with 12 additions and 10 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
||||||
path = "src/kill.rs"
|
path = "src/kill.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
|
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||||
nix = { version = "0.25", features = ["signal"] }
|
nix = { version = "0.25", features = ["signal"] }
|
||||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["signals"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["signals"] }
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,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 nix::sys::signal::{self, Signal};
|
use nix::sys::signal::{self, Signal};
|
||||||
use nix::unistd::Pid;
|
use nix::unistd::Pid;
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
|
@ -43,9 +43,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
|
|
||||||
let matches = uu_app().try_get_matches_from(args)?;
|
let matches = uu_app().try_get_matches_from(args)?;
|
||||||
|
|
||||||
let mode = if matches.contains_id(options::TABLE) {
|
let mode = if matches.get_flag(options::TABLE) {
|
||||||
Mode::Table
|
Mode::Table
|
||||||
} else if matches.contains_id(options::LIST) {
|
} else if matches.get_flag(options::LIST) {
|
||||||
Mode::List
|
Mode::List
|
||||||
} else {
|
} else {
|
||||||
Mode::Kill
|
Mode::Kill
|
||||||
|
@ -80,7 +80,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app<'a>() -> Command<'a> {
|
pub fn uu_app() -> Command {
|
||||||
Command::new(uucore::util_name())
|
Command::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
|
@ -92,26 +92,28 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.short('l')
|
.short('l')
|
||||||
.long(options::LIST)
|
.long(options::LIST)
|
||||||
.help("Lists signals")
|
.help("Lists signals")
|
||||||
.conflicts_with(options::TABLE),
|
.conflicts_with(options::TABLE)
|
||||||
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::TABLE)
|
Arg::new(options::TABLE)
|
||||||
.short('t')
|
.short('t')
|
||||||
.short_alias('L')
|
.short_alias('L')
|
||||||
.long(options::TABLE)
|
.long(options::TABLE)
|
||||||
.help("Lists table of signals"),
|
.help("Lists table of signals")
|
||||||
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::SIGNAL)
|
Arg::new(options::SIGNAL)
|
||||||
.short('s')
|
.short('s')
|
||||||
.long(options::SIGNAL)
|
.long(options::SIGNAL)
|
||||||
.help("Sends given signal")
|
.value_name("signal")
|
||||||
.takes_value(true),
|
.help("Sends given signal instead of SIGTERM"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::PIDS_OR_SIGNALS)
|
Arg::new(options::PIDS_OR_SIGNALS)
|
||||||
.hide(true)
|
.hide(true)
|
||||||
.multiple_occurrences(true),
|
.action(ArgAction::Append),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue