mirror of
https://github.com/uutils/procps.git
synced 2026-06-10 16:14:00 -07:00
pidof: Implemented -o (#123)
* pidof: Implemented `-o` This commit implemented two usage of `-o` which are already implemented in GNU's implementation, but not in ours. ```shell ❯ cargo run pidof zsh 116473 116472 116401 116391 ❯ cargo run pidof -o116473,116472 zsh 116401 116391 ❯ cargo run pidof -o116473 -o116472 zsh 116401 116391 ``` And the GNU's implementation: ```shell ❯ pidof zsh 116473 116472 116401 116391 ❯ pidof -o116473,116472 zsh 116401 116391 ❯ pidof -o116473 -o116472 zsh 116401 116391 ``` * pidof: Add test for `-q` flag. * pidof: Simplify tests.
This commit is contained in:
@@ -137,6 +137,7 @@ pub fn uu_app() -> Command {
|
||||
Arg::new("o")
|
||||
.short('o')
|
||||
.help("Omit results with a given PID")
|
||||
.value_delimiter(',')
|
||||
.action(ArgAction::Append)
|
||||
.value_parser(clap::value_parser!(usize))
|
||||
.value_name("omitpid"),
|
||||
|
||||
@@ -33,3 +33,9 @@ fn test_no_program() {
|
||||
fn test_no_pid_found() {
|
||||
new_ucmd!().arg("NO_THIS_PROGRAM").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_quiet() {
|
||||
new_ucmd!().arg("kthreadd").arg("-q").succeeds().no_output();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user