|
7 | 7 | pub mod process; |
8 | 8 | pub mod process_matcher; |
9 | 9 |
|
10 | | -use clap::{arg, crate_version, Arg, ArgAction, ArgGroup, Command}; |
| 10 | +use clap::{arg, crate_version, Command}; |
11 | 11 | use uucore::{error::UResult, format_usage, help_about, help_usage}; |
12 | 12 |
|
13 | 13 | const ABOUT: &str = help_about!("pgrep.md"); |
@@ -76,61 +76,16 @@ pub fn uu_app() -> Command { |
76 | 76 | .about(ABOUT) |
77 | 77 | .override_usage(format_usage(USAGE)) |
78 | 78 | .args_override_self(true) |
79 | | - .group(ArgGroup::new("oldest_newest").args(["oldest", "newest", "inverse"])) |
80 | 79 | .args([ |
81 | 80 | arg!(-d --delimiter <string> "specify output delimiter") |
82 | 81 | .default_value("\n") |
83 | 82 | .hide_default_value(true), |
84 | 83 | arg!(-l --"list-name" "list PID and process name"), |
85 | 84 | arg!(-a --"list-full" "list PID and full command line"), |
86 | | - arg!(-H --"require-handler" "match only if signal handler is present"), |
87 | | - arg!(-v --inverse "negates the matching"), |
88 | 85 | // arg!(-w --lightweight "list all TID"), |
89 | | - arg!(-c --count "count of matching processes"), |
90 | | - arg!(-f --full "use full process name to match"), |
91 | | - // arg!(-g --pgroup <PGID> ... "match listed process group IDs") |
92 | | - // .value_delimiter(',') |
93 | | - // .value_parser(clap::value_parser!(u64)), |
94 | | - // arg!(-G --group <GID> ... "match real group IDs") |
95 | | - // .value_delimiter(',') |
96 | | - // .value_parser(clap::value_parser!(u64)), |
97 | | - arg!(-i --"ignore-case" "match case insensitively"), |
98 | | - arg!(-n --newest "select most recently started"), |
99 | | - arg!(-o --oldest "select least recently started"), |
100 | | - arg!(-O --older <seconds> "select where older than seconds") |
101 | | - .value_parser(clap::value_parser!(u64)), |
102 | | - arg!(-P --parent <PPID> "match only child processes of the given parent") |
103 | | - .value_delimiter(',') |
104 | | - .value_parser(clap::value_parser!(u64)), |
105 | | - // arg!(-s --session <SID> "match session IDs") |
106 | | - // .value_delimiter(',') |
107 | | - // .value_parser(clap::value_parser!(u64)), |
108 | | - arg!(--signal <sig> "signal to send (either number or name)") |
109 | | - .default_value("SIGTERM"), |
110 | | - arg!(-t --terminal <tty> "match by controlling terminal") |
111 | | - .value_delimiter(','), |
112 | | - // arg!(-u --euid <ID> ... "match by effective IDs") |
113 | | - // .value_delimiter(',') |
114 | | - // .value_parser(clap::value_parser!(u64)), |
115 | | - // arg!(-U --uid <ID> ... "match by real IDs") |
116 | | - // .value_delimiter(',') |
117 | | - // .value_parser(clap::value_parser!(u64)), |
118 | | - arg!(-x --exact "match exactly with the command name"), |
119 | | - // arg!(-F --pidfile <file> "read PIDs from file"), |
120 | | - // arg!(-L --logpidfile "fail if PID file is not locked"), |
121 | | - arg!(-r --runstates <state> "match runstates [D,S,Z,...]"), |
122 | | - // arg!(-A --"ignore-ancestors" "exclude our ancestors from results"), |
123 | | - // arg!(--cgroup <grp> "match by cgroup v2 names") |
124 | | - // .value_delimiter(','), |
125 | | - // arg!( --ns <PID> "match the processes that belong to the same namespace as <pid>"), |
126 | | - // arg!( --nslist <ns> ... "list which namespaces will be considered for the --ns option.") |
127 | | - // .value_delimiter(',') |
128 | | - // .value_parser(["ipc", "mnt", "net", "pid", "user", "uts"]), |
129 | 86 | ]) |
130 | | - .arg( |
131 | | - Arg::new("pattern") |
132 | | - .help("Name of the program to find the PID of") |
133 | | - .action(ArgAction::Append) |
134 | | - .index(1), |
135 | | - ) |
| 87 | + .args(process_matcher::clap_args( |
| 88 | + "Name of the program to find the PID of", |
| 89 | + true, |
| 90 | + )) |
136 | 91 | } |
0 commit comments