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

nproc: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:16:20 +01:00
parent 5e9443567d
commit 5702313e9c
2 changed files with 5 additions and 7 deletions

View file

@ -17,7 +17,7 @@ path = "src/nproc.rs"
[dependencies]
libc = "0.2.42"
num_cpus = "1.10"
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["fs"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -33,7 +33,7 @@ fn usage() -> String {
#[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
let mut ignore = match matches.value_of(OPT_IGNORE) {
Some(numstr) => match numstr.parse() {
@ -71,19 +71,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.arg(
Arg::with_name(OPT_ALL)
.short("")
Arg::new(OPT_ALL)
.long(OPT_ALL)
.help("print the number of cores available to the system"),
)
.arg(
Arg::with_name(OPT_IGNORE)
.short("")
Arg::new(OPT_IGNORE)
.long(OPT_IGNORE)
.takes_value(true)
.help("ignore up to N cores"),