1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #2863 from tertsdiepraam/clap-3

Clap 3
This commit is contained in:
Terts Diepraam 2022-01-20 23:14:52 +01:00 committed by GitHub
commit 55a47f6fc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
221 changed files with 2091 additions and 2042 deletions

292
Cargo.lock generated
View file

@ -96,7 +96,7 @@ dependencies = [
"bitflags", "bitflags",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"clap", "clap 2.34.0",
"env_logger 0.9.0", "env_logger 0.9.0",
"lazy_static", "lazy_static",
"lazycell", "lazycell",
@ -250,13 +250,38 @@ dependencies = [
"ansi_term", "ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"strsim", "strsim 0.8.0",
"term_size",
"textwrap 0.11.0", "textwrap 0.11.0",
"unicode-width", "unicode-width",
"vec_map", "vec_map",
] ]
[[package]]
name = "clap"
version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c506244a13c87262f84bf16369740d0b7c3850901b6a642aa41b031a710c473"
dependencies = [
"atty",
"bitflags",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim 0.10.0",
"termcolor",
"terminal_size",
"textwrap 0.14.2",
]
[[package]]
name = "clap_complete"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d044e9db8cd0f68191becdeb5246b7462e4cf0c069b19ae00d1bf3fa9889498d"
dependencies = [
"clap 3.0.9",
]
[[package]] [[package]]
name = "cloudabi" name = "cloudabi"
version = "0.0.3" version = "0.0.3"
@ -293,7 +318,8 @@ version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"chrono", "chrono",
"clap", "clap 3.0.9",
"clap_complete",
"conv", "conv",
"filetime", "filetime",
"glob", "glob",
@ -858,6 +884,12 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.3.3"
@ -905,6 +937,16 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec"
[[package]]
name = "indexmap"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown 0.11.2",
]
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.12" version = "0.1.12"
@ -1236,7 +1278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c672c7ad9ec066e428c00eb917124a06f08db19e2584de982cc34b1f4c12485" checksum = "1c672c7ad9ec066e428c00eb917124a06f08db19e2584de982cc34b1f4c12485"
dependencies = [ dependencies = [
"dlv-list", "dlv-list",
"hashbrown", "hashbrown 0.9.1",
] ]
[[package]] [[package]]
@ -1248,6 +1290,15 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr 2.4.1",
]
[[package]] [[package]]
name = "ouroboros" name = "ouroboros"
version = "0.10.1" version = "0.10.1"
@ -1754,9 +1805,18 @@ dependencies = [
[[package]] [[package]]
name = "sha1" name = "sha1"
version = "0.6.0" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770"
dependencies = [
"sha1_smol",
]
[[package]]
name = "sha1_smol"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
[[package]] [[package]]
name = "sha2" name = "sha2"
@ -1853,6 +1913,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.21.0" version = "0.21.0"
@ -1905,16 +1971,6 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "term_size"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
dependencies = [
"libc",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.1.2" version = "1.1.2"
@ -1965,7 +2021,6 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [ dependencies = [
"term_size",
"unicode-width", "unicode-width",
] ]
@ -2101,7 +2156,7 @@ checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b"
name = "uu_arch" name = "uu_arch"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"platform-info", "platform-info",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2111,7 +2166,7 @@ dependencies = [
name = "uu_base32" name = "uu_base32"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2120,7 +2175,6 @@ dependencies = [
name = "uu_base64" name = "uu_base64"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap",
"uu_base32", "uu_base32",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2130,7 +2184,7 @@ dependencies = [
name = "uu_basename" name = "uu_basename"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2139,7 +2193,7 @@ dependencies = [
name = "uu_basenc" name = "uu_basenc"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uu_base32", "uu_base32",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2150,7 +2204,7 @@ name = "uu_cat"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap", "clap 3.0.9",
"nix 0.23.1", "nix 0.23.1",
"thiserror", "thiserror",
"unix_socket", "unix_socket",
@ -2163,7 +2217,7 @@ dependencies = [
name = "uu_chcon" name = "uu_chcon"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"fts-sys", "fts-sys",
"libc", "libc",
"selinux", "selinux",
@ -2176,7 +2230,7 @@ dependencies = [
name = "uu_chgrp" name = "uu_chgrp"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2185,7 +2239,7 @@ dependencies = [
name = "uu_chmod" name = "uu_chmod"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2196,7 +2250,7 @@ dependencies = [
name = "uu_chown" name = "uu_chown"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2205,7 +2259,7 @@ dependencies = [
name = "uu_chroot" name = "uu_chroot"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2214,7 +2268,7 @@ dependencies = [
name = "uu_cksum" name = "uu_cksum"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2224,7 +2278,7 @@ dependencies = [
name = "uu_comm" name = "uu_comm"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2234,7 +2288,7 @@ dependencies = [
name = "uu_cp" name = "uu_cp"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"exacl", "exacl",
"filetime", "filetime",
"ioctl-sys", "ioctl-sys",
@ -2252,7 +2306,7 @@ dependencies = [
name = "uu_csplit" name = "uu_csplit"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"regex", "regex",
"thiserror", "thiserror",
"uucore", "uucore",
@ -2265,7 +2319,7 @@ version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"bstr", "bstr",
"clap", "clap 3.0.9",
"memchr 2.4.1", "memchr 2.4.1",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2276,7 +2330,7 @@ name = "uu_date"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2288,7 +2342,7 @@ name = "uu_dd"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"byte-unit", "byte-unit",
"clap", "clap 3.0.9",
"gcd", "gcd",
"libc", "libc",
"signal-hook", "signal-hook",
@ -2301,7 +2355,7 @@ dependencies = [
name = "uu_df" name = "uu_df"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"number_prefix", "number_prefix",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2311,7 +2365,7 @@ dependencies = [
name = "uu_dircolors" name = "uu_dircolors"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"glob", "glob",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2321,7 +2375,7 @@ dependencies = [
name = "uu_dirname" name = "uu_dirname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2332,7 +2386,7 @@ name = "uu_du"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
"winapi 0.3.9", "winapi 0.3.9",
@ -2342,7 +2396,7 @@ dependencies = [
name = "uu_echo" name = "uu_echo"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2351,7 +2405,7 @@ dependencies = [
name = "uu_env" name = "uu_env"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"rust-ini", "rust-ini",
"uucore", "uucore",
@ -2362,7 +2416,7 @@ dependencies = [
name = "uu_expand" name = "uu_expand"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"unicode-width", "unicode-width",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2372,7 +2426,7 @@ dependencies = [
name = "uu_expr" name = "uu_expr"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"num-bigint", "num-bigint",
"num-traits", "num-traits",
@ -2385,7 +2439,7 @@ dependencies = [
name = "uu_factor" name = "uu_factor"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"coz", "coz",
"num-traits", "num-traits",
"paste 0.1.18", "paste 0.1.18",
@ -2400,7 +2454,7 @@ dependencies = [
name = "uu_false" name = "uu_false"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2409,7 +2463,7 @@ dependencies = [
name = "uu_fmt" name = "uu_fmt"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"unicode-width", "unicode-width",
"uucore", "uucore",
@ -2420,7 +2474,7 @@ dependencies = [
name = "uu_fold" name = "uu_fold"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2429,7 +2483,7 @@ dependencies = [
name = "uu_groups" name = "uu_groups"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2439,7 +2493,7 @@ name = "uu_hashsum"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"blake2b_simd", "blake2b_simd",
"clap", "clap 3.0.9",
"digest", "digest",
"hex", "hex",
"libc", "libc",
@ -2458,7 +2512,7 @@ dependencies = [
name = "uu_head" name = "uu_head"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"memchr 2.4.1", "memchr 2.4.1",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2468,7 +2522,7 @@ dependencies = [
name = "uu_hostid" name = "uu_hostid"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2478,7 +2532,7 @@ dependencies = [
name = "uu_hostname" name = "uu_hostname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"hostname", "hostname",
"libc", "libc",
"uucore", "uucore",
@ -2490,7 +2544,7 @@ dependencies = [
name = "uu_id" name = "uu_id"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"selinux", "selinux",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2500,7 +2554,7 @@ dependencies = [
name = "uu_install" name = "uu_install"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"file_diff", "file_diff",
"filetime", "filetime",
"libc", "libc",
@ -2513,7 +2567,7 @@ dependencies = [
name = "uu_join" name = "uu_join"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2522,7 +2576,7 @@ dependencies = [
name = "uu_kill" name = "uu_kill"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2532,7 +2586,7 @@ dependencies = [
name = "uu_link" name = "uu_link"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2542,7 +2596,7 @@ dependencies = [
name = "uu_ln" name = "uu_ln"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2552,7 +2606,7 @@ dependencies = [
name = "uu_logname" name = "uu_logname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2564,7 +2618,7 @@ version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"chrono", "chrono",
"clap", "clap 3.0.9",
"glob", "glob",
"lazy_static", "lazy_static",
"lscolors", "lscolors",
@ -2582,7 +2636,7 @@ dependencies = [
name = "uu_mkdir" name = "uu_mkdir"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2592,7 +2646,7 @@ dependencies = [
name = "uu_mkfifo" name = "uu_mkfifo"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2602,7 +2656,7 @@ dependencies = [
name = "uu_mknod" name = "uu_mknod"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2612,7 +2666,7 @@ dependencies = [
name = "uu_mktemp" name = "uu_mktemp"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"rand 0.5.6", "rand 0.5.6",
"tempfile", "tempfile",
"uucore", "uucore",
@ -2624,7 +2678,7 @@ name = "uu_more"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap", "clap 3.0.9",
"crossterm", "crossterm",
"nix 0.23.1", "nix 0.23.1",
"redox_syscall", "redox_syscall",
@ -2639,7 +2693,7 @@ dependencies = [
name = "uu_mv" name = "uu_mv"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"fs_extra", "fs_extra",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2649,7 +2703,7 @@ dependencies = [
name = "uu_nice" name = "uu_nice"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
@ -2661,7 +2715,7 @@ name = "uu_nl"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"clap", "clap 3.0.9",
"libc", "libc",
"memchr 2.4.1", "memchr 2.4.1",
"regex", "regex",
@ -2675,7 +2729,7 @@ name = "uu_nohup"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2685,7 +2739,7 @@ dependencies = [
name = "uu_nproc" name = "uu_nproc"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"num_cpus", "num_cpus",
"uucore", "uucore",
@ -2696,7 +2750,7 @@ dependencies = [
name = "uu_numfmt" name = "uu_numfmt"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2706,7 +2760,7 @@ name = "uu_od"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"clap", "clap 3.0.9",
"half", "half",
"libc", "libc",
"uucore", "uucore",
@ -2717,7 +2771,7 @@ dependencies = [
name = "uu_paste" name = "uu_paste"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2726,7 +2780,7 @@ dependencies = [
name = "uu_pathchk" name = "uu_pathchk"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2736,7 +2790,7 @@ dependencies = [
name = "uu_pinky" name = "uu_pinky"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2746,7 +2800,7 @@ name = "uu_pr"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap 3.0.9",
"getopts", "getopts",
"itertools 0.10.3", "itertools 0.10.3",
"quick-error 2.0.1", "quick-error 2.0.1",
@ -2759,7 +2813,7 @@ dependencies = [
name = "uu_printenv" name = "uu_printenv"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2768,7 +2822,7 @@ dependencies = [
name = "uu_printf" name = "uu_printf"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"itertools 0.8.2", "itertools 0.8.2",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2779,7 +2833,7 @@ name = "uu_ptx"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"clap", "clap 3.0.9",
"libc", "libc",
"memchr 2.4.1", "memchr 2.4.1",
"regex", "regex",
@ -2792,7 +2846,7 @@ dependencies = [
name = "uu_pwd" name = "uu_pwd"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2801,7 +2855,7 @@ dependencies = [
name = "uu_readlink" name = "uu_readlink"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2811,7 +2865,7 @@ dependencies = [
name = "uu_realpath" name = "uu_realpath"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2820,7 +2874,7 @@ dependencies = [
name = "uu_relpath" name = "uu_relpath"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2829,7 +2883,7 @@ dependencies = [
name = "uu_rm" name = "uu_rm"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"remove_dir_all", "remove_dir_all",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2841,7 +2895,7 @@ dependencies = [
name = "uu_rmdir" name = "uu_rmdir"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2851,7 +2905,7 @@ dependencies = [
name = "uu_runcon" name = "uu_runcon"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"fts-sys", "fts-sys",
"libc", "libc",
"selinux", "selinux",
@ -2865,7 +2919,7 @@ name = "uu_seq"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"bigdecimal", "bigdecimal",
"clap", "clap 3.0.9",
"num-bigint", "num-bigint",
"num-traits", "num-traits",
"uucore", "uucore",
@ -2876,7 +2930,7 @@ dependencies = [
name = "uu_shred" name = "uu_shred"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"rand 0.7.3", "rand 0.7.3",
"uucore", "uucore",
@ -2887,7 +2941,7 @@ dependencies = [
name = "uu_shuf" name = "uu_shuf"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"rand 0.5.6", "rand 0.5.6",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2897,7 +2951,7 @@ dependencies = [
name = "uu_sleep" name = "uu_sleep"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2907,7 +2961,7 @@ name = "uu_sort"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"binary-heap-plus", "binary-heap-plus",
"clap", "clap 3.0.9",
"compare", "compare",
"ctrlc", "ctrlc",
"fnv", "fnv",
@ -2926,7 +2980,7 @@ dependencies = [
name = "uu_split" name = "uu_split"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2935,7 +2989,7 @@ dependencies = [
name = "uu_stat" name = "uu_stat"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2944,7 +2998,7 @@ dependencies = [
name = "uu_stdbuf" name = "uu_stdbuf"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"tempfile", "tempfile",
"uu_stdbuf_libstdbuf", "uu_stdbuf_libstdbuf",
"uucore", "uucore",
@ -2966,7 +3020,7 @@ dependencies = [
name = "uu_sum" name = "uu_sum"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -2975,7 +3029,7 @@ dependencies = [
name = "uu_sync" name = "uu_sync"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -2986,7 +3040,7 @@ dependencies = [
name = "uu_tac" name = "uu_tac"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"memchr 2.4.1", "memchr 2.4.1",
"memmap2", "memmap2",
"regex", "regex",
@ -2998,7 +3052,7 @@ dependencies = [
name = "uu_tail" name = "uu_tail"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"redox_syscall", "redox_syscall",
@ -3011,7 +3065,7 @@ dependencies = [
name = "uu_tee" name = "uu_tee"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"retain_mut", "retain_mut",
"uucore", "uucore",
@ -3022,7 +3076,7 @@ dependencies = [
name = "uu_test" name = "uu_test"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"redox_syscall", "redox_syscall",
"uucore", "uucore",
@ -3033,7 +3087,7 @@ dependencies = [
name = "uu_timeout" name = "uu_timeout"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
@ -3044,7 +3098,7 @@ dependencies = [
name = "uu_touch" name = "uu_touch"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"filetime", "filetime",
"time", "time",
"uucore", "uucore",
@ -3056,7 +3110,7 @@ name = "uu_tr"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"clap", "clap 3.0.9",
"fnv", "fnv",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -3066,7 +3120,7 @@ dependencies = [
name = "uu_true" name = "uu_true"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3075,7 +3129,7 @@ dependencies = [
name = "uu_truncate" name = "uu_truncate"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3084,7 +3138,7 @@ dependencies = [
name = "uu_tsort" name = "uu_tsort"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3094,7 +3148,7 @@ name = "uu_tty"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -3104,7 +3158,7 @@ dependencies = [
name = "uu_uname" name = "uu_uname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"platform-info", "platform-info",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -3114,7 +3168,7 @@ dependencies = [
name = "uu_unexpand" name = "uu_unexpand"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"unicode-width", "unicode-width",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -3124,7 +3178,7 @@ dependencies = [
name = "uu_uniq" name = "uu_uniq"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"strum", "strum",
"strum_macros", "strum_macros",
"uucore", "uucore",
@ -3135,7 +3189,7 @@ dependencies = [
name = "uu_unlink" name = "uu_unlink"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3145,7 +3199,7 @@ name = "uu_uptime"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3154,7 +3208,7 @@ dependencies = [
name = "uu_users" name = "uu_users"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3164,7 +3218,7 @@ name = "uu_wc"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"bytecount", "bytecount",
"clap", "clap 3.0.9",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"unicode-width", "unicode-width",
@ -3177,7 +3231,7 @@ dependencies = [
name = "uu_who" name = "uu_who"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
] ]
@ -3186,7 +3240,7 @@ dependencies = [
name = "uu_whoami" name = "uu_whoami"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"libc", "libc",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -3197,7 +3251,7 @@ dependencies = [
name = "uu_yes" name = "uu_yes"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
"uucore_procs", "uucore_procs",
@ -3207,7 +3261,7 @@ dependencies = [
name = "uucore" name = "uucore"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap", "clap 3.0.9",
"data-encoding", "data-encoding",
"data-encoding-macro", "data-encoding-macro",
"dns-lookup", "dns-lookup",

View file

@ -244,7 +244,8 @@ test = [ "uu_test" ]
[workspace] [workspace]
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
clap_complete = "3.0"
lazy_static = { version="1.3" } lazy_static = { version="1.3" }
textwrap = { version="0.14", features=["terminal_size"] } textwrap = { version="0.14", features=["terminal_size"] }
uucore = { version=">=0.0.11", package="uucore", path="src/uucore" } uucore = { version=">=0.0.11", package="uucore", path="src/uucore" }

View file

@ -43,7 +43,7 @@ pub fn main() {
let mut tf = File::create(Path::new(&out_dir).join("test_modules.rs")).unwrap(); let mut tf = File::create(Path::new(&out_dir).join("test_modules.rs")).unwrap();
mf.write_all( mf.write_all(
"type UtilityMap<T> = HashMap<&'static str, (fn(T) -> i32, fn() -> App<'static, 'static>)>;\n\ "type UtilityMap<T> = HashMap<&'static str, (fn(T) -> i32, fn() -> App<'static>)>;\n\
\n\ \n\
fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n\ fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n\
\t#[allow(unused_mut)]\n\ \t#[allow(unused_mut)]\n\

View file

@ -5,9 +5,8 @@
// For the full copyright and license information, please view the LICENSE // For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code. // file that was distributed with this source code.
use clap::App; use clap::{App, Arg};
use clap::Arg; use clap_complete::Shell;
use clap::Shell;
use std::cmp; use std::cmp;
use std::collections::hash_map::HashMap; use std::collections::hash_map::HashMap;
use std::ffi::OsStr; use std::ffi::OsStr;
@ -143,13 +142,13 @@ fn gen_completions<T: uucore::Args>(
let matches = App::new("completion") let matches = App::new("completion")
.about("Prints completions to stdout") .about("Prints completions to stdout")
.arg( .arg(
Arg::with_name("utility") Arg::new("utility")
.possible_values(&all_utilities) .possible_values(all_utilities)
.required(true), .required(true),
) )
.arg( .arg(
Arg::with_name("shell") Arg::new("shell")
.possible_values(&Shell::variants()) .possible_values(Shell::possible_values())
.required(true), .required(true),
) )
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args)); .get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
@ -165,12 +164,12 @@ fn gen_completions<T: uucore::Args>(
let shell: Shell = shell.parse().unwrap(); let shell: Shell = shell.parse().unwrap();
let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility; let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility;
app.gen_completions_to(bin_name, shell, &mut io::stdout()); clap_complete::generate(shell, &mut app, bin_name, &mut io::stdout());
io::stdout().flush().unwrap(); io::stdout().flush().unwrap();
process::exit(0); process::exit(0);
} }
fn gen_coreutils_app<T: uucore::Args>(util_map: UtilityMap<T>) -> App<'static, 'static> { fn gen_coreutils_app<T: uucore::Args>(util_map: UtilityMap<T>) -> App<'static> {
let mut app = App::new("coreutils"); let mut app = App::new("coreutils");
for (_, (_, sub_app)) in util_map { for (_, (_, sub_app)) in util_map {
app = app.subcommand(sub_app()); app = app.subcommand(sub_app());

View file

@ -16,7 +16,7 @@ path = "src/arch.rs"
[dependencies] [dependencies]
platform-info = "0.2" platform-info = "0.2"
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -23,7 +23,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/base32.rs" path = "src/base32.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -47,6 +47,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
) )
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
base_common::base_app(ABOUT) base_common::base_app(ABOUT)
} }

View file

@ -86,33 +86,33 @@ impl Config {
} }
pub fn parse_base_cmd_args(args: impl uucore::Args, about: &str, usage: &str) -> UResult<Config> { pub fn parse_base_cmd_args(args: impl uucore::Args, about: &str, usage: &str) -> UResult<Config> {
let app = base_app(about).usage(usage); let app = base_app(about).override_usage(usage);
let arg_list = args let arg_list = args
.collect_str(InvalidEncodingHandling::ConvertLossy) .collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any(); .accept_any();
Config::from(&app.get_matches_from(arg_list)) Config::from(&app.get_matches_from(arg_list))
} }
pub fn base_app<'a>(about: &'a str) -> App<'static, 'a> { pub fn base_app(about: &str) -> App {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(about) .about(about)
// Format arguments. // Format arguments.
.arg( .arg(
Arg::with_name(options::DECODE) Arg::new(options::DECODE)
.short("d") .short('d')
.long(options::DECODE) .long(options::DECODE)
.help("decode data"), .help("decode data"),
) )
.arg( .arg(
Arg::with_name(options::IGNORE_GARBAGE) Arg::new(options::IGNORE_GARBAGE)
.short("i") .short('i')
.long(options::IGNORE_GARBAGE) .long(options::IGNORE_GARBAGE)
.help("when decoding, ignore non-alphabetic characters"), .help("when decoding, ignore non-alphabetic characters"),
) )
.arg( .arg(
Arg::with_name(options::WRAP) Arg::new(options::WRAP)
.short("w") .short('w')
.long(options::WRAP) .long(options::WRAP)
.takes_value(true) .takes_value(true)
.help( .help(
@ -121,7 +121,7 @@ pub fn base_app<'a>(about: &'a str) -> App<'static, 'a> {
) )
// "multiple" arguments are used to check whether there is more than one // "multiple" arguments are used to check whether there is more than one
// file passed in. // file passed in.
.arg(Arg::with_name(options::FILE).index(1).multiple(true)) .arg(Arg::new(options::FILE).index(1).multiple_occurrences(true))
} }
pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult<Box<dyn Read + 'a>> { pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult<Box<dyn Read + 'a>> {

View file

@ -15,7 +15,6 @@ edition = "2018"
path = "src/base64.rs" path = "src/base64.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"} uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"}

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/basename.rs" path = "src/basename.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -40,7 +40,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// //
// Argument parsing // Argument parsing
// //
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
// too few arguments // too few arguments
if !matches.is_present(options::NAME) { if !matches.is_present(options::NAME) {
@ -93,27 +93,31 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.arg( .arg(
Arg::with_name(options::MULTIPLE) Arg::new(options::MULTIPLE)
.short("a") .short('a')
.long(options::MULTIPLE) .long(options::MULTIPLE)
.help("support multiple arguments and treat each as a NAME"), .help("support multiple arguments and treat each as a NAME"),
) )
.arg(Arg::with_name(options::NAME).multiple(true).hidden(true))
.arg( .arg(
Arg::with_name(options::SUFFIX) Arg::new(options::NAME)
.short("s") .multiple_occurrences(true)
.hide(true),
)
.arg(
Arg::new(options::SUFFIX)
.short('s')
.long(options::SUFFIX) .long(options::SUFFIX)
.value_name("SUFFIX") .value_name("SUFFIX")
.help("remove a trailing SUFFIX; implies -a"), .help("remove a trailing SUFFIX; implies -a"),
) )
.arg( .arg(
Arg::with_name(options::ZERO) Arg::new(options::ZERO)
.short("z") .short('z')
.long(options::ZERO) .long(options::ZERO)
.help("end each output line with NUL, not newline"), .help("end each output line with NUL, not newline"),
) )

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/basenc.rs" path = "src/basenc.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"} uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"}

View file

@ -45,17 +45,17 @@ fn usage() -> String {
format!("{0} [OPTION]... [FILE]", uucore::execution_phrase()) format!("{0} [OPTION]... [FILE]", uucore::execution_phrase())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
let mut app = base_common::base_app(ABOUT); let mut app = base_common::base_app(ABOUT);
for encoding in ENCODINGS { for encoding in ENCODINGS {
app = app.arg(Arg::with_name(encoding.0).long(encoding.0)); app = app.arg(Arg::new(encoding.0).long(encoding.0));
} }
app app
} }
fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> { fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
let usage = usage(); let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from( let matches = uu_app().override_usage(&usage[..]).get_matches_from(
args.collect_str(InvalidEncodingHandling::ConvertLossy) args.collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any(), .accept_any(),
); );

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/cat.rs" path = "src/cat.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
thiserror = "1.0" thiserror = "1.0"
atty = "0.2" atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "pipes"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "pipes"] }

View file

@ -239,64 +239,68 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
cat_files(files, &options) cat_files(files, &options)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.usage(SYNTAX) .override_usage(SYNTAX)
.about(SUMMARY) .about(SUMMARY)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
.arg( .arg(
Arg::with_name(options::SHOW_ALL) Arg::new(options::FILE)
.short("A") .hide(true)
.multiple_occurrences(true),
)
.arg(
Arg::new(options::SHOW_ALL)
.short('A')
.long(options::SHOW_ALL) .long(options::SHOW_ALL)
.help("equivalent to -vET"), .help("equivalent to -vET"),
) )
.arg( .arg(
Arg::with_name(options::NUMBER_NONBLANK) Arg::new(options::NUMBER_NONBLANK)
.short("b") .short('b')
.long(options::NUMBER_NONBLANK) .long(options::NUMBER_NONBLANK)
.help("number nonempty output lines, overrides -n") .help("number nonempty output lines, overrides -n")
.overrides_with(options::NUMBER), .overrides_with(options::NUMBER),
) )
.arg( .arg(
Arg::with_name(options::SHOW_NONPRINTING_ENDS) Arg::new(options::SHOW_NONPRINTING_ENDS)
.short("e") .short('e')
.help("equivalent to -vE"), .help("equivalent to -vE"),
) )
.arg( .arg(
Arg::with_name(options::SHOW_ENDS) Arg::new(options::SHOW_ENDS)
.short("E") .short('E')
.long(options::SHOW_ENDS) .long(options::SHOW_ENDS)
.help("display $ at end of each line"), .help("display $ at end of each line"),
) )
.arg( .arg(
Arg::with_name(options::NUMBER) Arg::new(options::NUMBER)
.short("n") .short('n')
.long(options::NUMBER) .long(options::NUMBER)
.help("number all output lines"), .help("number all output lines"),
) )
.arg( .arg(
Arg::with_name(options::SQUEEZE_BLANK) Arg::new(options::SQUEEZE_BLANK)
.short("s") .short('s')
.long(options::SQUEEZE_BLANK) .long(options::SQUEEZE_BLANK)
.help("suppress repeated empty output lines"), .help("suppress repeated empty output lines"),
) )
.arg( .arg(
Arg::with_name(options::SHOW_NONPRINTING_TABS) Arg::new(options::SHOW_NONPRINTING_TABS)
.short("t") .short('t')
.long(options::SHOW_NONPRINTING_TABS) .long(options::SHOW_NONPRINTING_TABS)
.help("equivalent to -vT"), .help("equivalent to -vT"),
) )
.arg( .arg(
Arg::with_name(options::SHOW_TABS) Arg::new(options::SHOW_TABS)
.short("T") .short('T')
.long(options::SHOW_TABS) .long(options::SHOW_TABS)
.help("display TAB characters at ^I"), .help("display TAB characters at ^I"),
) )
.arg( .arg(
Arg::with_name(options::SHOW_NONPRINTING) Arg::new(options::SHOW_NONPRINTING)
.short("v") .short('v')
.long(options::SHOW_NONPRINTING) .long(options::SHOW_NONPRINTING)
.help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)"), .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)"),
) )

View file

@ -14,7 +14,7 @@ edition = "2018"
path = "src/chcon.rs" path = "src/chcon.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version = ">=0.0.9", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore = { version = ">=0.0.9", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
uucore_procs = { version = ">=0.0.6", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version = ">=0.0.6", package="uucore_procs", path="../../uucore_procs" }
selinux = { version = "0.2" } selinux = { version = "0.2" }

View file

@ -65,14 +65,14 @@ fn get_usage() -> String {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = get_usage(); let usage = get_usage();
let config = uu_app().usage(usage.as_ref()); let config = uu_app().override_usage(usage.as_ref());
let options = match parse_command_line(config, args) { let options = match parse_command_line(config, args) {
Ok(r) => r, Ok(r) => r,
Err(r) => { Err(r) => {
if let Error::CommandLine(r) = &r { if let Error::CommandLine(r) = &r {
match r.kind { match r.kind {
clap::ErrorKind::HelpDisplayed | clap::ErrorKind::VersionDisplayed => { clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => {
println!("{}", r); println!("{}", r);
return Ok(()); return Ok(());
} }
@ -160,12 +160,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Err(libc::EXIT_FAILURE.into()) Err(libc::EXIT_FAILURE.into())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(VERSION) .version(VERSION)
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::dereference::DEREFERENCE) Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE) .long(options::dereference::DEREFERENCE)
.conflicts_with(options::dereference::NO_DEREFERENCE) .conflicts_with(options::dereference::NO_DEREFERENCE)
.help( .help(
@ -174,24 +174,24 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::dereference::NO_DEREFERENCE) Arg::new(options::dereference::NO_DEREFERENCE)
.short("h") .short('h')
.long(options::dereference::NO_DEREFERENCE) .long(options::dereference::NO_DEREFERENCE)
.help("Affect symbolic links instead of any referenced file."), .help("Affect symbolic links instead of any referenced file."),
) )
.arg( .arg(
Arg::with_name(options::preserve_root::PRESERVE_ROOT) Arg::new(options::preserve_root::PRESERVE_ROOT)
.long(options::preserve_root::PRESERVE_ROOT) .long(options::preserve_root::PRESERVE_ROOT)
.conflicts_with(options::preserve_root::NO_PRESERVE_ROOT) .conflicts_with(options::preserve_root::NO_PRESERVE_ROOT)
.help("Fail to operate recursively on '/'."), .help("Fail to operate recursively on '/'."),
) )
.arg( .arg(
Arg::with_name(options::preserve_root::NO_PRESERVE_ROOT) Arg::new(options::preserve_root::NO_PRESERVE_ROOT)
.long(options::preserve_root::NO_PRESERVE_ROOT) .long(options::preserve_root::NO_PRESERVE_ROOT)
.help("Do not treat '/' specially (the default)."), .help("Do not treat '/' specially (the default)."),
) )
.arg( .arg(
Arg::with_name(options::REFERENCE) Arg::new(options::REFERENCE)
.long(options::REFERENCE) .long(options::REFERENCE)
.takes_value(true) .takes_value(true)
.value_name("RFILE") .value_name("RFILE")
@ -199,49 +199,54 @@ pub fn uu_app() -> App<'static, 'static> {
.help( .help(
"Use security context of RFILE, rather than specifying \ "Use security context of RFILE, rather than specifying \
a CONTEXT value.", a CONTEXT value.",
), )
.allow_invalid_utf8(true),
) )
.arg( .arg(
Arg::with_name(options::USER) Arg::new(options::USER)
.short("u") .short('u')
.long(options::USER) .long(options::USER)
.takes_value(true) .takes_value(true)
.value_name("USER") .value_name("USER")
.help("Set user USER in the target security context."), .help("Set user USER in the target security context.")
.allow_invalid_utf8(true),
) )
.arg( .arg(
Arg::with_name(options::ROLE) Arg::new(options::ROLE)
.short("r") .short('r')
.long(options::ROLE) .long(options::ROLE)
.takes_value(true) .takes_value(true)
.value_name("ROLE") .value_name("ROLE")
.help("Set role ROLE in the target security context."), .help("Set role ROLE in the target security context.")
.allow_invalid_utf8(true),
) )
.arg( .arg(
Arg::with_name(options::TYPE) Arg::new(options::TYPE)
.short("t") .short('t')
.long(options::TYPE) .long(options::TYPE)
.takes_value(true) .takes_value(true)
.value_name("TYPE") .value_name("TYPE")
.help("Set type TYPE in the target security context."), .help("Set type TYPE in the target security context.")
.allow_invalid_utf8(true),
) )
.arg( .arg(
Arg::with_name(options::RANGE) Arg::new(options::RANGE)
.short("l") .short('l')
.long(options::RANGE) .long(options::RANGE)
.takes_value(true) .takes_value(true)
.value_name("RANGE") .value_name("RANGE")
.help("Set range RANGE in the target security context."), .help("Set range RANGE in the target security context.")
.allow_invalid_utf8(true),
) )
.arg( .arg(
Arg::with_name(options::RECURSIVE) Arg::new(options::RECURSIVE)
.short("R") .short('R')
.long(options::RECURSIVE) .long(options::RECURSIVE)
.help("Operate on files and directories recursively."), .help("Operate on files and directories recursively."),
) )
.arg( .arg(
Arg::with_name(options::sym_links::FOLLOW_ARG_DIR_SYM_LINK) Arg::new(options::sym_links::FOLLOW_ARG_DIR_SYM_LINK)
.short("H") .short('H')
.requires(options::RECURSIVE) .requires(options::RECURSIVE)
.overrides_with_all(&[ .overrides_with_all(&[
options::sym_links::FOLLOW_DIR_SYM_LINKS, options::sym_links::FOLLOW_DIR_SYM_LINKS,
@ -253,8 +258,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::sym_links::FOLLOW_DIR_SYM_LINKS) Arg::new(options::sym_links::FOLLOW_DIR_SYM_LINKS)
.short("L") .short('L')
.requires(options::RECURSIVE) .requires(options::RECURSIVE)
.overrides_with_all(&[ .overrides_with_all(&[
options::sym_links::FOLLOW_ARG_DIR_SYM_LINK, options::sym_links::FOLLOW_ARG_DIR_SYM_LINK,
@ -266,8 +271,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::sym_links::NO_FOLLOW_SYM_LINKS) Arg::new(options::sym_links::NO_FOLLOW_SYM_LINKS)
.short("P") .short('P')
.requires(options::RECURSIVE) .requires(options::RECURSIVE)
.overrides_with_all(&[ .overrides_with_all(&[
options::sym_links::FOLLOW_ARG_DIR_SYM_LINK, options::sym_links::FOLLOW_ARG_DIR_SYM_LINK,
@ -279,12 +284,17 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE) Arg::new(options::VERBOSE)
.short("v") .short('v')
.long(options::VERBOSE) .long(options::VERBOSE)
.help("Output a diagnostic for every file processed."), .help("Output a diagnostic for every file processed."),
) )
.arg(Arg::with_name("FILE").multiple(true).min_values(1)) .arg(
Arg::new("FILE")
.multiple_occurrences(true)
.min_values(1)
.allow_invalid_utf8(true),
)
} }
#[derive(Debug)] #[derive(Debug)]
@ -298,7 +308,7 @@ struct Options {
} }
fn parse_command_line(config: clap::App, args: impl uucore::Args) -> Result<Options> { fn parse_command_line(config: clap::App, args: impl uucore::Args) -> Result<Options> {
let matches = config.get_matches_from_safe(args)?; let matches = config.try_get_matches_from(args)?;
let verbose = matches.is_present(options::VERBOSE); let verbose = matches.is_present(options::VERBOSE);

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chgrp.rs" path = "src/chgrp.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -56,7 +56,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = get_usage(); let usage = get_usage();
chown_base( chown_base(
uu_app().usage(&usage[..]), uu_app().override_usage(&usage[..]),
args, args,
options::ARG_GROUP, options::ARG_GROUP,
parse_gid_and_uid, parse_gid_and_uid,
@ -64,82 +64,82 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
) )
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(VERSION) .version(VERSION)
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::verbosity::CHANGES) Arg::new(options::verbosity::CHANGES)
.short("c") .short('c')
.long(options::verbosity::CHANGES) .long(options::verbosity::CHANGES)
.help("like verbose but report only when a change is made"), .help("like verbose but report only when a change is made"),
) )
.arg( .arg(
Arg::with_name(options::verbosity::SILENT) Arg::new(options::verbosity::SILENT)
.short("f") .short('f')
.long(options::verbosity::SILENT), .long(options::verbosity::SILENT),
) )
.arg( .arg(
Arg::with_name(options::verbosity::QUIET) Arg::new(options::verbosity::QUIET)
.long(options::verbosity::QUIET) .long(options::verbosity::QUIET)
.help("suppress most error messages"), .help("suppress most error messages"),
) )
.arg( .arg(
Arg::with_name(options::verbosity::VERBOSE) Arg::new(options::verbosity::VERBOSE)
.short("v") .short('v')
.long(options::verbosity::VERBOSE) .long(options::verbosity::VERBOSE)
.help("output a diagnostic for every file processed"), .help("output a diagnostic for every file processed"),
) )
.arg( .arg(
Arg::with_name(options::dereference::DEREFERENCE) Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE), .long(options::dereference::DEREFERENCE),
) )
.arg( .arg(
Arg::with_name(options::dereference::NO_DEREFERENCE) Arg::new(options::dereference::NO_DEREFERENCE)
.short("h") .short('h')
.long(options::dereference::NO_DEREFERENCE) .long(options::dereference::NO_DEREFERENCE)
.help( .help(
"affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)",
), ),
) )
.arg( .arg(
Arg::with_name(options::preserve_root::PRESERVE) Arg::new(options::preserve_root::PRESERVE)
.long(options::preserve_root::PRESERVE) .long(options::preserve_root::PRESERVE)
.help("fail to operate recursively on '/'"), .help("fail to operate recursively on '/'"),
) )
.arg( .arg(
Arg::with_name(options::preserve_root::NO_PRESERVE) Arg::new(options::preserve_root::NO_PRESERVE)
.long(options::preserve_root::NO_PRESERVE) .long(options::preserve_root::NO_PRESERVE)
.help("do not treat '/' specially (the default)"), .help("do not treat '/' specially (the default)"),
) )
.arg( .arg(
Arg::with_name(options::REFERENCE) Arg::new(options::REFERENCE)
.long(options::REFERENCE) .long(options::REFERENCE)
.value_name("RFILE") .value_name("RFILE")
.help("use RFILE's group rather than specifying GROUP values") .help("use RFILE's group rather than specifying GROUP values")
.takes_value(true) .takes_value(true)
.multiple(false), .multiple_occurrences(false),
) )
.arg( .arg(
Arg::with_name(options::RECURSIVE) Arg::new(options::RECURSIVE)
.short("R") .short('R')
.long(options::RECURSIVE) .long(options::RECURSIVE)
.help("operate on files and directories recursively"), .help("operate on files and directories recursively"),
) )
.arg( .arg(
Arg::with_name(options::traverse::TRAVERSE) Arg::new(options::traverse::TRAVERSE)
.short(options::traverse::TRAVERSE) .short(options::traverse::TRAVERSE.chars().next().unwrap())
.help("if a command line argument is a symbolic link to a directory, traverse it"), .help("if a command line argument is a symbolic link to a directory, traverse it"),
) )
.arg( .arg(
Arg::with_name(options::traverse::NO_TRAVERSE) Arg::new(options::traverse::NO_TRAVERSE)
.short(options::traverse::NO_TRAVERSE) .short(options::traverse::NO_TRAVERSE.chars().next().unwrap())
.help("do not traverse any symbolic links (default)") .help("do not traverse any symbolic links (default)")
.overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]),
) )
.arg( .arg(
Arg::with_name(options::traverse::EVERY) Arg::new(options::traverse::EVERY)
.short(options::traverse::EVERY) .short(options::traverse::EVERY.chars().next().unwrap())
.help("traverse every symbolic link to a directory encountered"), .help("traverse every symbolic link to a directory encountered"),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chmod.rs" path = "src/chmod.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -62,7 +62,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let after_help = get_long_usage(); let after_help = get_long_usage();
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&after_help[..]) .after_help(&after_help[..])
.get_matches_from(args); .get_matches_from(args);
@ -121,63 +121,63 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
chmoder.chmod(files) chmoder.chmod(files)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::CHANGES) Arg::new(options::CHANGES)
.long(options::CHANGES) .long(options::CHANGES)
.short("c") .short('c')
.help("like verbose but report only when a change is made"), .help("like verbose but report only when a change is made"),
) )
.arg( .arg(
Arg::with_name(options::QUIET) Arg::new(options::QUIET)
.long(options::QUIET) .long(options::QUIET)
.visible_alias("silent") .visible_alias("silent")
.short("f") .short('f')
.help("suppress most error messages"), .help("suppress most error messages"),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE) Arg::new(options::VERBOSE)
.long(options::VERBOSE) .long(options::VERBOSE)
.short("v") .short('v')
.help("output a diagnostic for every file processed"), .help("output a diagnostic for every file processed"),
) )
.arg( .arg(
Arg::with_name(options::NO_PRESERVE_ROOT) Arg::new(options::NO_PRESERVE_ROOT)
.long(options::NO_PRESERVE_ROOT) .long(options::NO_PRESERVE_ROOT)
.help("do not treat '/' specially (the default)"), .help("do not treat '/' specially (the default)"),
) )
.arg( .arg(
Arg::with_name(options::PRESERVE_ROOT) Arg::new(options::PRESERVE_ROOT)
.long(options::PRESERVE_ROOT) .long(options::PRESERVE_ROOT)
.help("fail to operate recursively on '/'"), .help("fail to operate recursively on '/'"),
) )
.arg( .arg(
Arg::with_name(options::RECURSIVE) Arg::new(options::RECURSIVE)
.long(options::RECURSIVE) .long(options::RECURSIVE)
.short("R") .short('R')
.help("change files and directories recursively"), .help("change files and directories recursively"),
) )
.arg( .arg(
Arg::with_name(options::REFERENCE) Arg::new(options::REFERENCE)
.long("reference") .long("reference")
.takes_value(true) .takes_value(true)
.help("use RFILE's mode instead of MODE values"), .help("use RFILE's mode instead of MODE values"),
) )
.arg( .arg(
Arg::with_name(options::MODE) Arg::new(options::MODE)
.required_unless(options::REFERENCE) .required_unless_present(options::REFERENCE)
.takes_value(true), .takes_value(true),
// It would be nice if clap could parse with delimiter, e.g. "g-x,u+x", // It would be nice if clap could parse with delimiter, e.g. "g-x,u+x",
// however .multiple(true) cannot be used here because FILE already needs that. // however .multiple_occurrences(true) cannot be used here because FILE already needs that.
// Only one positional argument with .multiple(true) set is allowed per command // Only one positional argument with .multiple_occurrences(true) set is allowed per command
) )
.arg( .arg(
Arg::with_name(options::FILE) Arg::new(options::FILE)
.required_unless(options::MODE) .required_unless_present(options::MODE)
.multiple(true), .multiple_occurrences(true),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chown.rs" path = "src/chown.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -59,7 +59,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = get_usage(); let usage = get_usage();
chown_base( chown_base(
uu_app().usage(&usage[..]), uu_app().override_usage(&usage[..]),
args, args,
options::ARG_OWNER, options::ARG_OWNER,
parse_gid_uid_and_filter, parse_gid_uid_and_filter,
@ -67,18 +67,18 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
) )
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::verbosity::CHANGES) Arg::new(options::verbosity::CHANGES)
.short("c") .short('c')
.long(options::verbosity::CHANGES) .long(options::verbosity::CHANGES)
.help("like verbose but report only when a change is made"), .help("like verbose but report only when a change is made"),
) )
.arg( .arg(
Arg::with_name(options::dereference::DEREFERENCE) Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE) .long(options::dereference::DEREFERENCE)
.help( .help(
"affect the referent of each symbolic link (this is the default), \ "affect the referent of each symbolic link (this is the default), \
@ -86,8 +86,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::dereference::NO_DEREFERENCE) Arg::new(options::dereference::NO_DEREFERENCE)
.short("h") .short('h')
.long(options::dereference::NO_DEREFERENCE) .long(options::dereference::NO_DEREFERENCE)
.help( .help(
"affect symbolic links instead of any referenced file \ "affect symbolic links instead of any referenced file \
@ -95,7 +95,7 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::FROM) Arg::new(options::FROM)
.long(options::FROM) .long(options::FROM)
.help( .help(
"change the owner and/or group of each file only if its \ "change the owner and/or group of each file only if its \
@ -106,60 +106,60 @@ pub fn uu_app() -> App<'static, 'static> {
.value_name("CURRENT_OWNER:CURRENT_GROUP"), .value_name("CURRENT_OWNER:CURRENT_GROUP"),
) )
.arg( .arg(
Arg::with_name(options::preserve_root::PRESERVE) Arg::new(options::preserve_root::PRESERVE)
.long(options::preserve_root::PRESERVE) .long(options::preserve_root::PRESERVE)
.help("fail to operate recursively on '/'"), .help("fail to operate recursively on '/'"),
) )
.arg( .arg(
Arg::with_name(options::preserve_root::NO_PRESERVE) Arg::new(options::preserve_root::NO_PRESERVE)
.long(options::preserve_root::NO_PRESERVE) .long(options::preserve_root::NO_PRESERVE)
.help("do not treat '/' specially (the default)"), .help("do not treat '/' specially (the default)"),
) )
.arg( .arg(
Arg::with_name(options::verbosity::QUIET) Arg::new(options::verbosity::QUIET)
.long(options::verbosity::QUIET) .long(options::verbosity::QUIET)
.help("suppress most error messages"), .help("suppress most error messages"),
) )
.arg( .arg(
Arg::with_name(options::RECURSIVE) Arg::new(options::RECURSIVE)
.short("R") .short('R')
.long(options::RECURSIVE) .long(options::RECURSIVE)
.help("operate on files and directories recursively"), .help("operate on files and directories recursively"),
) )
.arg( .arg(
Arg::with_name(options::REFERENCE) Arg::new(options::REFERENCE)
.long(options::REFERENCE) .long(options::REFERENCE)
.help("use RFILE's owner and group rather than specifying OWNER:GROUP values") .help("use RFILE's owner and group rather than specifying OWNER:GROUP values")
.value_name("RFILE") .value_name("RFILE")
.min_values(1), .min_values(1),
) )
.arg( .arg(
Arg::with_name(options::verbosity::SILENT) Arg::new(options::verbosity::SILENT)
.short("f") .short('f')
.long(options::verbosity::SILENT), .long(options::verbosity::SILENT),
) )
.arg( .arg(
Arg::with_name(options::traverse::TRAVERSE) Arg::new(options::traverse::TRAVERSE)
.short(options::traverse::TRAVERSE) .short(options::traverse::TRAVERSE.chars().next().unwrap())
.help("if a command line argument is a symbolic link to a directory, traverse it") .help("if a command line argument is a symbolic link to a directory, traverse it")
.overrides_with_all(&[options::traverse::EVERY, options::traverse::NO_TRAVERSE]), .overrides_with_all(&[options::traverse::EVERY, options::traverse::NO_TRAVERSE]),
) )
.arg( .arg(
Arg::with_name(options::traverse::EVERY) Arg::new(options::traverse::EVERY)
.short(options::traverse::EVERY) .short(options::traverse::EVERY.chars().next().unwrap())
.help("traverse every symbolic link to a directory encountered") .help("traverse every symbolic link to a directory encountered")
.overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE]), .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE]),
) )
.arg( .arg(
Arg::with_name(options::traverse::NO_TRAVERSE) Arg::new(options::traverse::NO_TRAVERSE)
.short(options::traverse::NO_TRAVERSE) .short(options::traverse::NO_TRAVERSE.chars().next().unwrap())
.help("do not traverse any symbolic links (default)") .help("do not traverse any symbolic links (default)")
.overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]),
) )
.arg( .arg(
Arg::with_name(options::verbosity::VERBOSE) Arg::new(options::verbosity::VERBOSE)
.long(options::verbosity::VERBOSE) .long(options::verbosity::VERBOSE)
.short("v") .short('v')
.help("output a diagnostic for every file processed"), .help("output a diagnostic for every file processed"),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chroot.rs" path = "src/chroot.rs"
[dependencies] [dependencies]
clap= "2.33" clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -91,40 +91,40 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.usage(SYNTAX) .override_usage(SYNTAX)
.arg( .arg(
Arg::with_name(options::NEWROOT) Arg::new(options::NEWROOT)
.hidden(true) .hide(true)
.required(true) .required(true)
.index(1), .index(1),
) )
.arg( .arg(
Arg::with_name(options::USER) Arg::new(options::USER)
.short("u") .short('u')
.long(options::USER) .long(options::USER)
.help("User (ID or name) to switch before running the program") .help("User (ID or name) to switch before running the program")
.value_name("USER"), .value_name("USER"),
) )
.arg( .arg(
Arg::with_name(options::GROUP) Arg::new(options::GROUP)
.short("g") .short('g')
.long(options::GROUP) .long(options::GROUP)
.help("Group (ID or name) to switch to") .help("Group (ID or name) to switch to")
.value_name("GROUP"), .value_name("GROUP"),
) )
.arg( .arg(
Arg::with_name(options::GROUPS) Arg::new(options::GROUPS)
.short("G") .short('G')
.long(options::GROUPS) .long(options::GROUPS)
.help("Comma-separated list of groups to switch to") .help("Comma-separated list of groups to switch to")
.value_name("GROUP1,GROUP2..."), .value_name("GROUP1,GROUP2..."),
) )
.arg( .arg(
Arg::with_name(options::USERSPEC) Arg::new(options::USERSPEC)
.long(options::USERSPEC) .long(options::USERSPEC)
.help( .help(
"Colon-separated user and group to switch to. \ "Colon-separated user and group to switch to. \
@ -134,9 +134,9 @@ pub fn uu_app() -> App<'static, 'static> {
.value_name("USER:GROUP"), .value_name("USER:GROUP"),
) )
.arg( .arg(
Arg::with_name(options::COMMAND) Arg::new(options::COMMAND)
.hidden(true) .hide(true)
.multiple(true) .multiple_occurrences(true)
.index(2), .index(2),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/cksum.rs" path = "src/cksum.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -140,11 +140,15 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.usage(SYNTAX) .override_usage(SYNTAX)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .arg(
Arg::new(options::FILE)
.hide(true)
.multiple_occurrences(true),
)
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/comm.rs" path = "src/comm.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -137,7 +137,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.collect_str(InvalidEncodingHandling::ConvertLossy) .collect_str(InvalidEncodingHandling::ConvertLossy)
.accept_any(); .accept_any();
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
let filename1 = matches.value_of(options::FILE_1).unwrap(); let filename1 = matches.value_of(options::FILE_1).unwrap();
let filename2 = matches.value_of(options::FILE_2).unwrap(); let filename2 = matches.value_of(options::FILE_2).unwrap();
let mut f1 = open_file(filename1).map_err_context(|| filename1.to_string())?; let mut f1 = open_file(filename1).map_err_context(|| filename1.to_string())?;
@ -147,34 +147,34 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.arg( .arg(
Arg::with_name(options::COLUMN_1) Arg::new(options::COLUMN_1)
.short(options::COLUMN_1) .short('1')
.help("suppress column 1 (lines unique to FILE1)"), .help("suppress column 1 (lines unique to FILE1)"),
) )
.arg( .arg(
Arg::with_name(options::COLUMN_2) Arg::new(options::COLUMN_2)
.short(options::COLUMN_2) .short('2')
.help("suppress column 2 (lines unique to FILE2)"), .help("suppress column 2 (lines unique to FILE2)"),
) )
.arg( .arg(
Arg::with_name(options::COLUMN_3) Arg::new(options::COLUMN_3)
.short(options::COLUMN_3) .short('3')
.help("suppress column 3 (lines that appear in both files)"), .help("suppress column 3 (lines that appear in both files)"),
) )
.arg( .arg(
Arg::with_name(options::DELIMITER) Arg::new(options::DELIMITER)
.long(options::DELIMITER) .long(options::DELIMITER)
.help("separate columns with STR") .help("separate columns with STR")
.value_name("STR") .value_name("STR")
.default_value(options::DELIMITER_DEFAULT) .default_value(options::DELIMITER_DEFAULT)
.hide_default_value(true), .hide_default_value(true),
) )
.arg(Arg::with_name(options::FILE_1).required(true)) .arg(Arg::new(options::FILE_1).required(true))
.arg(Arg::with_name(options::FILE_2).required(true)) .arg(Arg::new(options::FILE_2).required(true))
} }

View file

@ -19,7 +19,7 @@ edition = "2018"
path = "src/cp.rs" path = "src/cp.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
filetime = "0.2" filetime = "0.2"
libc = "0.2.85" libc = "0.2.85"
quick-error = "1.2.3" quick-error = "1.2.3"

View file

@ -296,65 +296,65 @@ static DEFAULT_ATTRIBUTES: &[Attribute] = &[
Attribute::Timestamps, Attribute::Timestamps,
]; ];
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg(Arg::with_name(options::TARGET_DIRECTORY) .arg(Arg::new(options::TARGET_DIRECTORY)
.short("t") .short('t')
.conflicts_with(options::NO_TARGET_DIRECTORY) .conflicts_with(options::NO_TARGET_DIRECTORY)
.long(options::TARGET_DIRECTORY) .long(options::TARGET_DIRECTORY)
.value_name(options::TARGET_DIRECTORY) .value_name(options::TARGET_DIRECTORY)
.takes_value(true) .takes_value(true)
.help("copy all SOURCE arguments into target-directory")) .help("copy all SOURCE arguments into target-directory"))
.arg(Arg::with_name(options::NO_TARGET_DIRECTORY) .arg(Arg::new(options::NO_TARGET_DIRECTORY)
.short("T") .short('T')
.long(options::NO_TARGET_DIRECTORY) .long(options::NO_TARGET_DIRECTORY)
.conflicts_with(options::TARGET_DIRECTORY) .conflicts_with(options::TARGET_DIRECTORY)
.help("Treat DEST as a regular file and not a directory")) .help("Treat DEST as a regular file and not a directory"))
.arg(Arg::with_name(options::INTERACTIVE) .arg(Arg::new(options::INTERACTIVE)
.short("i") .short('i')
.long(options::INTERACTIVE) .long(options::INTERACTIVE)
.conflicts_with(options::NO_CLOBBER) .conflicts_with(options::NO_CLOBBER)
.help("ask before overwriting files")) .help("ask before overwriting files"))
.arg(Arg::with_name(options::LINK) .arg(Arg::new(options::LINK)
.short("l") .short('l')
.long(options::LINK) .long(options::LINK)
.overrides_with(options::REFLINK) .overrides_with(options::REFLINK)
.help("hard-link files instead of copying")) .help("hard-link files instead of copying"))
.arg(Arg::with_name(options::NO_CLOBBER) .arg(Arg::new(options::NO_CLOBBER)
.short("n") .short('n')
.long(options::NO_CLOBBER) .long(options::NO_CLOBBER)
.conflicts_with(options::INTERACTIVE) .conflicts_with(options::INTERACTIVE)
.help("don't overwrite a file that already exists")) .help("don't overwrite a file that already exists"))
.arg(Arg::with_name(options::RECURSIVE) .arg(Arg::new(options::RECURSIVE)
.short("r") .short('r')
.long(options::RECURSIVE) .long(options::RECURSIVE)
// --archive sets this option // --archive sets this option
.help("copy directories recursively")) .help("copy directories recursively"))
.arg(Arg::with_name(options::RECURSIVE_ALIAS) .arg(Arg::new(options::RECURSIVE_ALIAS)
.short("R") .short('R')
.help("same as -r")) .help("same as -r"))
.arg(Arg::with_name(options::STRIP_TRAILING_SLASHES) .arg(Arg::new(options::STRIP_TRAILING_SLASHES)
.long(options::STRIP_TRAILING_SLASHES) .long(options::STRIP_TRAILING_SLASHES)
.help("remove any trailing slashes from each SOURCE argument")) .help("remove any trailing slashes from each SOURCE argument"))
.arg(Arg::with_name(options::VERBOSE) .arg(Arg::new(options::VERBOSE)
.short("v") .short('v')
.long(options::VERBOSE) .long(options::VERBOSE)
.help("explicitly state what is being done")) .help("explicitly state what is being done"))
.arg(Arg::with_name(options::SYMBOLIC_LINK) .arg(Arg::new(options::SYMBOLIC_LINK)
.short("s") .short('s')
.long(options::SYMBOLIC_LINK) .long(options::SYMBOLIC_LINK)
.conflicts_with(options::LINK) .conflicts_with(options::LINK)
.overrides_with(options::REFLINK) .overrides_with(options::REFLINK)
.help("make symbolic links instead of copying")) .help("make symbolic links instead of copying"))
.arg(Arg::with_name(options::FORCE) .arg(Arg::new(options::FORCE)
.short("f") .short('f')
.long(options::FORCE) .long(options::FORCE)
.help("if an existing destination file cannot be opened, remove it and \ .help("if an existing destination file cannot be opened, remove it and \
try again (this option is ignored when the -n option is also used). \ try again (this option is ignored when the -n option is also used). \
Currently not implemented for Windows.")) Currently not implemented for Windows."))
.arg(Arg::with_name(options::REMOVE_DESTINATION) .arg(Arg::new(options::REMOVE_DESTINATION)
.long(options::REMOVE_DESTINATION) .long(options::REMOVE_DESTINATION)
.conflicts_with(options::FORCE) .conflicts_with(options::FORCE)
.help("remove each existing destination file before attempting to open it \ .help("remove each existing destination file before attempting to open it \
@ -362,25 +362,25 @@ pub fn uu_app() -> App<'static, 'static> {
.arg(backup_control::arguments::backup()) .arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args()) .arg(backup_control::arguments::backup_no_args())
.arg(backup_control::arguments::suffix()) .arg(backup_control::arguments::suffix())
.arg(Arg::with_name(options::UPDATE) .arg(Arg::new(options::UPDATE)
.short("u") .short('u')
.long(options::UPDATE) .long(options::UPDATE)
.help("copy only when the SOURCE file is newer than the destination file \ .help("copy only when the SOURCE file is newer than the destination file \
or when the destination file is missing")) or when the destination file is missing"))
.arg(Arg::with_name(options::REFLINK) .arg(Arg::new(options::REFLINK)
.long(options::REFLINK) .long(options::REFLINK)
.takes_value(true) .takes_value(true)
.value_name("WHEN") .value_name("WHEN")
.help("control clone/CoW copies. See below")) .help("control clone/CoW copies. See below"))
.arg(Arg::with_name(options::ATTRIBUTES_ONLY) .arg(Arg::new(options::ATTRIBUTES_ONLY)
.long(options::ATTRIBUTES_ONLY) .long(options::ATTRIBUTES_ONLY)
.conflicts_with(options::COPY_CONTENTS) .conflicts_with(options::COPY_CONTENTS)
.overrides_with(options::REFLINK) .overrides_with(options::REFLINK)
.help("Don't copy the file data, just the attributes")) .help("Don't copy the file data, just the attributes"))
.arg(Arg::with_name(options::PRESERVE) .arg(Arg::new(options::PRESERVE)
.long(options::PRESERVE) .long(options::PRESERVE)
.takes_value(true) .takes_value(true)
.multiple(true) .multiple_occurrences(true)
.use_delimiter(true) .use_delimiter(true)
.possible_values(PRESERVABLE_ATTRIBUTES) .possible_values(PRESERVABLE_ATTRIBUTES)
.min_values(0) .min_values(0)
@ -390,67 +390,67 @@ pub fn uu_app() -> App<'static, 'static> {
// --archive sets this option // --archive sets this option
.help("Preserve the specified attributes (default: mode, ownership (unix only), timestamps), \ .help("Preserve the specified attributes (default: mode, ownership (unix only), timestamps), \
if possible additional attributes: context, links, xattr, all")) if possible additional attributes: context, links, xattr, all"))
.arg(Arg::with_name(options::PRESERVE_DEFAULT_ATTRIBUTES) .arg(Arg::new(options::PRESERVE_DEFAULT_ATTRIBUTES)
.short("-p") .short('p')
.long(options::PRESERVE_DEFAULT_ATTRIBUTES) .long(options::PRESERVE_DEFAULT_ATTRIBUTES)
.conflicts_with_all(&[options::PRESERVE, options::NO_PRESERVE, options::ARCHIVE]) .conflicts_with_all(&[options::PRESERVE, options::NO_PRESERVE, options::ARCHIVE])
.help("same as --preserve=mode,ownership(unix only),timestamps")) .help("same as --preserve=mode,ownership(unix only),timestamps"))
.arg(Arg::with_name(options::NO_PRESERVE) .arg(Arg::new(options::NO_PRESERVE)
.long(options::NO_PRESERVE) .long(options::NO_PRESERVE)
.takes_value(true) .takes_value(true)
.value_name("ATTR_LIST") .value_name("ATTR_LIST")
.conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::PRESERVE, options::ARCHIVE]) .conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::PRESERVE, options::ARCHIVE])
.help("don't preserve the specified attributes")) .help("don't preserve the specified attributes"))
.arg(Arg::with_name(options::PARENTS) .arg(Arg::new(options::PARENTS)
.long(options::PARENTS) .long(options::PARENTS)
.alias(options::PARENT) .alias(options::PARENT)
.help("use full source file name under DIRECTORY")) .help("use full source file name under DIRECTORY"))
.arg(Arg::with_name(options::NO_DEREFERENCE) .arg(Arg::new(options::NO_DEREFERENCE)
.short("-P") .short('P')
.long(options::NO_DEREFERENCE) .long(options::NO_DEREFERENCE)
.conflicts_with(options::DEREFERENCE) .conflicts_with(options::DEREFERENCE)
// -d sets this option // -d sets this option
.help("never follow symbolic links in SOURCE")) .help("never follow symbolic links in SOURCE"))
.arg(Arg::with_name(options::DEREFERENCE) .arg(Arg::new(options::DEREFERENCE)
.short("L") .short('L')
.long(options::DEREFERENCE) .long(options::DEREFERENCE)
.conflicts_with(options::NO_DEREFERENCE) .conflicts_with(options::NO_DEREFERENCE)
.help("always follow symbolic links in SOURCE")) .help("always follow symbolic links in SOURCE"))
.arg(Arg::with_name(options::ARCHIVE) .arg(Arg::new(options::ARCHIVE)
.short("a") .short('a')
.long(options::ARCHIVE) .long(options::ARCHIVE)
.conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::PRESERVE, options::NO_PRESERVE]) .conflicts_with_all(&[options::PRESERVE_DEFAULT_ATTRIBUTES, options::PRESERVE, options::NO_PRESERVE])
.help("Same as -dR --preserve=all")) .help("Same as -dR --preserve=all"))
.arg(Arg::with_name(options::NO_DEREFERENCE_PRESERVE_LINKS) .arg(Arg::new(options::NO_DEREFERENCE_PRESERVE_LINKS)
.short("d") .short('d')
.help("same as --no-dereference --preserve=links")) .help("same as --no-dereference --preserve=links"))
.arg(Arg::with_name(options::ONE_FILE_SYSTEM) .arg(Arg::new(options::ONE_FILE_SYSTEM)
.short("x") .short('x')
.long(options::ONE_FILE_SYSTEM) .long(options::ONE_FILE_SYSTEM)
.help("stay on this file system")) .help("stay on this file system"))
// TODO: implement the following args // TODO: implement the following args
.arg(Arg::with_name(options::COPY_CONTENTS) .arg(Arg::new(options::COPY_CONTENTS)
.long(options::COPY_CONTENTS) .long(options::COPY_CONTENTS)
.conflicts_with(options::ATTRIBUTES_ONLY) .conflicts_with(options::ATTRIBUTES_ONLY)
.help("NotImplemented: copy contents of special files when recursive")) .help("NotImplemented: copy contents of special files when recursive"))
.arg(Arg::with_name(options::SPARSE) .arg(Arg::new(options::SPARSE)
.long(options::SPARSE) .long(options::SPARSE)
.takes_value(true) .takes_value(true)
.value_name("WHEN") .value_name("WHEN")
.help("NotImplemented: control creation of sparse files. See below")) .help("NotImplemented: control creation of sparse files. See below"))
.arg(Arg::with_name(options::CONTEXT) .arg(Arg::new(options::CONTEXT)
.long(options::CONTEXT) .long(options::CONTEXT)
.takes_value(true) .takes_value(true)
.value_name("CTX") .value_name("CTX")
.help("NotImplemented: set SELinux security context of destination file to default type")) .help("NotImplemented: set SELinux security context of destination file to default type"))
.arg(Arg::with_name(options::CLI_SYMBOLIC_LINKS) .arg(Arg::new(options::CLI_SYMBOLIC_LINKS)
.short("H") .short('H')
.help("NotImplemented: follow command-line symbolic links in SOURCE")) .help("NotImplemented: follow command-line symbolic links in SOURCE"))
// END TODO // END TODO
.arg(Arg::with_name(options::PATHS) .arg(Arg::new(options::PATHS)
.multiple(true)) .multiple_occurrences(true))
} }
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
@ -462,7 +462,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
LONG_HELP, LONG_HELP,
backup_control::BACKUP_CONTROL_LONG_HELP backup_control::BACKUP_CONTROL_LONG_HELP
)) ))
.usage(&usage[..]) .override_usage(&usage[..])
.get_matches_from(args); .get_matches_from(args);
let options = Options::from_matches(&matches)?; let options = Options::from_matches(&matches)?;

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/csplit.rs" path = "src/csplit.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
thiserror = "1.0" thiserror = "1.0"
regex = "1.0.0" regex = "1.0.0"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs"] }

View file

@ -722,7 +722,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.collect_str(InvalidEncodingHandling::Ignore) .collect_str(InvalidEncodingHandling::Ignore)
.accept_any(); .accept_any();
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
// get the file to split // get the file to split
let file_name = matches.value_of(options::FILE).unwrap(); let file_name = matches.value_of(options::FILE).unwrap();
@ -751,60 +751,60 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.arg( .arg(
Arg::with_name(options::SUFFIX_FORMAT) Arg::new(options::SUFFIX_FORMAT)
.short("b") .short('b')
.long(options::SUFFIX_FORMAT) .long(options::SUFFIX_FORMAT)
.value_name("FORMAT") .value_name("FORMAT")
.help("use sprintf FORMAT instead of %02d"), .help("use sprintf FORMAT instead of %02d"),
) )
.arg( .arg(
Arg::with_name(options::PREFIX) Arg::new(options::PREFIX)
.short("f") .short('f')
.long(options::PREFIX) .long(options::PREFIX)
.value_name("PREFIX") .value_name("PREFIX")
.help("use PREFIX instead of 'xx'"), .help("use PREFIX instead of 'xx'"),
) )
.arg( .arg(
Arg::with_name(options::KEEP_FILES) Arg::new(options::KEEP_FILES)
.short("k") .short('k')
.long(options::KEEP_FILES) .long(options::KEEP_FILES)
.help("do not remove output files on errors"), .help("do not remove output files on errors"),
) )
.arg( .arg(
Arg::with_name(options::SUPPRESS_MATCHED) Arg::new(options::SUPPRESS_MATCHED)
.long(options::SUPPRESS_MATCHED) .long(options::SUPPRESS_MATCHED)
.help("suppress the lines matching PATTERN"), .help("suppress the lines matching PATTERN"),
) )
.arg( .arg(
Arg::with_name(options::DIGITS) Arg::new(options::DIGITS)
.short("n") .short('n')
.long(options::DIGITS) .long(options::DIGITS)
.value_name("DIGITS") .value_name("DIGITS")
.help("use specified number of digits instead of 2"), .help("use specified number of digits instead of 2"),
) )
.arg( .arg(
Arg::with_name(options::QUIET) Arg::new(options::QUIET)
.short("s") .short('s')
.long(options::QUIET) .long(options::QUIET)
.visible_alias("silent") .visible_alias("silent")
.help("do not print counts of output file sizes"), .help("do not print counts of output file sizes"),
) )
.arg( .arg(
Arg::with_name(options::ELIDE_EMPTY_FILES) Arg::new(options::ELIDE_EMPTY_FILES)
.short("z") .short('z')
.long(options::ELIDE_EMPTY_FILES) .long(options::ELIDE_EMPTY_FILES)
.help("remove empty output files"), .help("remove empty output files"),
) )
.arg(Arg::with_name(options::FILE).hidden(true).required(true)) .arg(Arg::new(options::FILE).hide(true).required(true))
.arg( .arg(
Arg::with_name(options::PATTERN) Arg::new(options::PATTERN)
.hidden(true) .hide(true)
.multiple(true) .multiple_occurrences(true)
.required(true), .required(true),
) )
.after_help(LONG_HELP) .after_help(LONG_HELP)

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/cut.rs" path = "src/cut.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
memchr = "2" memchr = "2"

View file

@ -532,16 +532,16 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.usage(SYNTAX) .override_usage(SYNTAX)
.about(SUMMARY) .about(SUMMARY)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.arg( .arg(
Arg::with_name(options::BYTES) Arg::new(options::BYTES)
.short("b") .short('b')
.long(options::BYTES) .long(options::BYTES)
.takes_value(true) .takes_value(true)
.help("filter byte columns from the input source") .help("filter byte columns from the input source")
@ -550,8 +550,8 @@ pub fn uu_app() -> App<'static, 'static> {
.display_order(1), .display_order(1),
) )
.arg( .arg(
Arg::with_name(options::CHARACTERS) Arg::new(options::CHARACTERS)
.short("c") .short('c')
.long(options::CHARACTERS) .long(options::CHARACTERS)
.help("alias for character mode") .help("alias for character mode")
.takes_value(true) .takes_value(true)
@ -560,8 +560,8 @@ pub fn uu_app() -> App<'static, 'static> {
.display_order(2), .display_order(2),
) )
.arg( .arg(
Arg::with_name(options::DELIMITER) Arg::new(options::DELIMITER)
.short("d") .short('d')
.long(options::DELIMITER) .long(options::DELIMITER)
.help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.")
.takes_value(true) .takes_value(true)
@ -569,8 +569,8 @@ pub fn uu_app() -> App<'static, 'static> {
.display_order(3), .display_order(3),
) )
.arg( .arg(
Arg::with_name(options::FIELDS) Arg::new(options::FIELDS)
.short("f") .short('f')
.long(options::FIELDS) .long(options::FIELDS)
.help("filter field columns from the input source") .help("filter field columns from the input source")
.takes_value(true) .takes_value(true)
@ -579,30 +579,30 @@ pub fn uu_app() -> App<'static, 'static> {
.display_order(4), .display_order(4),
) )
.arg( .arg(
Arg::with_name(options::COMPLEMENT) Arg::new(options::COMPLEMENT)
.long(options::COMPLEMENT) .long(options::COMPLEMENT)
.help("invert the filter - instead of displaying only the filtered columns, display all but those columns") .help("invert the filter - instead of displaying only the filtered columns, display all but those columns")
.takes_value(false) .takes_value(false)
.display_order(5), .display_order(5),
) )
.arg( .arg(
Arg::with_name(options::ONLY_DELIMITED) Arg::new(options::ONLY_DELIMITED)
.short("s") .short('s')
.long(options::ONLY_DELIMITED) .long(options::ONLY_DELIMITED)
.help("in field mode, only print lines which contain the delimiter") .help("in field mode, only print lines which contain the delimiter")
.takes_value(false) .takes_value(false)
.display_order(6), .display_order(6),
) )
.arg( .arg(
Arg::with_name(options::ZERO_TERMINATED) Arg::new(options::ZERO_TERMINATED)
.short("z") .short('z')
.long(options::ZERO_TERMINATED) .long(options::ZERO_TERMINATED)
.help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)")
.takes_value(false) .takes_value(false)
.display_order(8), .display_order(8),
) )
.arg( .arg(
Arg::with_name(options::OUTPUT_DELIMITER) Arg::new(options::OUTPUT_DELIMITER)
.long(options::OUTPUT_DELIMITER) .long(options::OUTPUT_DELIMITER)
.help("in field mode, replace the delimiter in output lines with this option's argument") .help("in field mode, replace the delimiter in output lines with this option's argument")
.takes_value(true) .takes_value(true)
@ -610,8 +610,8 @@ pub fn uu_app() -> App<'static, 'static> {
.display_order(7), .display_order(7),
) )
.arg( .arg(
Arg::with_name(options::FILE) Arg::new(options::FILE)
.hidden(true) .hide(true)
.multiple(true) .multiple_occurrences(true)
) )
} }

View file

@ -16,7 +16,7 @@ path = "src/date.rs"
[dependencies] [dependencies]
chrono = "^0.4.11" chrono = "^0.4.11"
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -147,7 +147,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
{0} [OPTION]... [MMDDhhmm[[CC]YY][.ss]]", {0} [OPTION]... [MMDDhhmm[[CC]YY][.ss]]",
NAME NAME
); );
let matches = uu_app().usage(&syntax[..]).get_matches_from(args); let matches = uu_app().override_usage(&syntax[..]).get_matches_from(args);
let format = if let Some(form) = matches.value_of(OPT_FORMAT) { let format = if let Some(form) = matches.value_of(OPT_FORMAT) {
if !form.starts_with('+') { if !form.starts_with('+') {
@ -257,70 +257,70 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(OPT_DATE) Arg::new(OPT_DATE)
.short("d") .short('d')
.long(OPT_DATE) .long(OPT_DATE)
.takes_value(true) .takes_value(true)
.help("display time described by STRING, not 'now'"), .help("display time described by STRING, not 'now'"),
) )
.arg( .arg(
Arg::with_name(OPT_FILE) Arg::new(OPT_FILE)
.short("f") .short('f')
.long(OPT_FILE) .long(OPT_FILE)
.takes_value(true) .takes_value(true)
.help("like --date; once for each line of DATEFILE"), .help("like --date; once for each line of DATEFILE"),
) )
.arg( .arg(
Arg::with_name(OPT_ISO_8601) Arg::new(OPT_ISO_8601)
.short("I") .short('I')
.long(OPT_ISO_8601) .long(OPT_ISO_8601)
.takes_value(true) .takes_value(true)
.help(ISO_8601_HELP_STRING), .help(ISO_8601_HELP_STRING),
) )
.arg( .arg(
Arg::with_name(OPT_RFC_EMAIL) Arg::new(OPT_RFC_EMAIL)
.short("R") .short('R')
.long(OPT_RFC_EMAIL) .long(OPT_RFC_EMAIL)
.help(RFC_5322_HELP_STRING), .help(RFC_5322_HELP_STRING),
) )
.arg( .arg(
Arg::with_name(OPT_RFC_3339) Arg::new(OPT_RFC_3339)
.long(OPT_RFC_3339) .long(OPT_RFC_3339)
.takes_value(true) .takes_value(true)
.help(RFC_3339_HELP_STRING), .help(RFC_3339_HELP_STRING),
) )
.arg( .arg(
Arg::with_name(OPT_DEBUG) Arg::new(OPT_DEBUG)
.long(OPT_DEBUG) .long(OPT_DEBUG)
.help("annotate the parsed date, and warn about questionable usage to stderr"), .help("annotate the parsed date, and warn about questionable usage to stderr"),
) )
.arg( .arg(
Arg::with_name(OPT_REFERENCE) Arg::new(OPT_REFERENCE)
.short("r") .short('r')
.long(OPT_REFERENCE) .long(OPT_REFERENCE)
.takes_value(true) .takes_value(true)
.help("display the last modification time of FILE"), .help("display the last modification time of FILE"),
) )
.arg( .arg(
Arg::with_name(OPT_SET) Arg::new(OPT_SET)
.short("s") .short('s')
.long(OPT_SET) .long(OPT_SET)
.takes_value(true) .takes_value(true)
.help(OPT_SET_HELP_STRING), .help(OPT_SET_HELP_STRING),
) )
.arg( .arg(
Arg::with_name(OPT_UNIVERSAL) Arg::new(OPT_UNIVERSAL)
.short("u") .short('u')
.long(OPT_UNIVERSAL) .long(OPT_UNIVERSAL)
.alias(OPT_UNIVERSAL_2) .alias(OPT_UNIVERSAL_2)
.help("print or set Coordinated Universal Time (UTC)"), .help("print or set Coordinated Universal Time (UTC)"),
) )
.arg(Arg::with_name(OPT_FORMAT).multiple(false)) .arg(Arg::new(OPT_FORMAT).multiple_occurrences(false))
} }
/// Return the appropriate format string for the given settings. /// Return the appropriate format string for the given settings.

View file

@ -16,7 +16,7 @@ path = "src/dd.rs"
[dependencies] [dependencies]
byte-unit = "4.0" byte-unit = "4.0"
clap = { version = "2.33", features = [ "wrap_help" ] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
gcd = "2.0" gcd = "2.0"
libc = "0.2" libc = "0.2"
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }

View file

@ -36,7 +36,7 @@ use std::thread;
use std::time; use std::time;
use byte_unit::Byte; use byte_unit::Byte;
use clap::{self, crate_version}; use clap::{crate_version, App, Arg, ArgMatches};
use gcd::Gcd; use gcd::Gcd;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use signal_hook::consts::signal; use signal_hook::consts::signal;
@ -932,12 +932,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> clap::App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
clap::App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
clap::Arg::with_name(options::INFILE) Arg::new(options::INFILE)
.long(options::INFILE) .long(options::INFILE)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -945,7 +945,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively if=FILE) specifies the file used for input. When not specified, stdin is used instead") .help("(alternatively if=FILE) specifies the file used for input. When not specified, stdin is used instead")
) )
.arg( .arg(
clap::Arg::with_name(options::OUTFILE) Arg::new(options::OUTFILE)
.long(options::OUTFILE) .long(options::OUTFILE)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -953,7 +953,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively of=FILE) specifies the file used for output. When not specified, stdout is used instead") .help("(alternatively of=FILE) specifies the file used for output. When not specified, stdout is used instead")
) )
.arg( .arg(
clap::Arg::with_name(options::IBS) Arg::new(options::IBS)
.long(options::IBS) .long(options::IBS)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -961,7 +961,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively ibs=N) specifies the size of buffer used for reads (default: 512). Multiplier strings permitted.") .help("(alternatively ibs=N) specifies the size of buffer used for reads (default: 512). Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::OBS) Arg::new(options::OBS)
.long(options::OBS) .long(options::OBS)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -969,7 +969,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively obs=N) specifies the size of buffer used for writes (default: 512). Multiplier strings permitted.") .help("(alternatively obs=N) specifies the size of buffer used for writes (default: 512). Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::BS) Arg::new(options::BS)
.long(options::BS) .long(options::BS)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -977,7 +977,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively bs=N) specifies ibs=N and obs=N (default: 512). If ibs or obs are also specified, bs=N takes precedence. Multiplier strings permitted.") .help("(alternatively bs=N) specifies ibs=N and obs=N (default: 512). If ibs or obs are also specified, bs=N takes precedence. Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::CBS) Arg::new(options::CBS)
.long(options::CBS) .long(options::CBS)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -985,7 +985,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively cbs=BYTES) specifies the 'conversion block size' in bytes. Applies to the conv=block, and conv=unblock operations. Multiplier strings permitted.") .help("(alternatively cbs=BYTES) specifies the 'conversion block size' in bytes. Applies to the conv=block, and conv=unblock operations. Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::SKIP) Arg::new(options::SKIP)
.long(options::SKIP) .long(options::SKIP)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -993,7 +993,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively skip=N) causes N ibs-sized records of input to be skipped before beginning copy/convert operations. See iflag=count_bytes if skipping N bytes is preferred. Multiplier strings permitted.") .help("(alternatively skip=N) causes N ibs-sized records of input to be skipped before beginning copy/convert operations. See iflag=count_bytes if skipping N bytes is preferred. Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::SEEK) Arg::new(options::SEEK)
.long(options::SEEK) .long(options::SEEK)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -1001,7 +1001,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively seek=N) seeks N obs-sized records into output before beginning copy/convert operations. See oflag=seek_bytes if seeking N bytes is preferred. Multiplier strings permitted.") .help("(alternatively seek=N) seeks N obs-sized records into output before beginning copy/convert operations. See oflag=seek_bytes if seeking N bytes is preferred. Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::COUNT) Arg::new(options::COUNT)
.long(options::COUNT) .long(options::COUNT)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -1009,7 +1009,7 @@ pub fn uu_app() -> clap::App<'static, 'static> {
.help("(alternatively count=N) stop reading input after N ibs-sized read operations rather than proceeding until EOF. See iflag=count_bytes if stopping after N bytes is preferred. Multiplier strings permitted.") .help("(alternatively count=N) stop reading input after N ibs-sized read operations rather than proceeding until EOF. See iflag=count_bytes if stopping after N bytes is preferred. Multiplier strings permitted.")
) )
.arg( .arg(
clap::Arg::with_name(options::STATUS) Arg::new(options::STATUS)
.long(options::STATUS) .long(options::STATUS)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -1033,7 +1033,7 @@ Printing performance stats is also triggered by the INFO signal (where supported
") ")
) )
.arg( .arg(
clap::Arg::with_name(options::CONV) Arg::new(options::CONV)
.long(options::CONV) .long(options::CONV)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -1070,7 +1070,7 @@ Conversion Flags:
") ")
) )
.arg( .arg(
clap::Arg::with_name(options::IFLAG) Arg::new(options::IFLAG)
.long(options::IFLAG) .long(options::IFLAG)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)
@ -1096,7 +1096,7 @@ General-Flags
") ")
) )
.arg( .arg(
clap::Arg::with_name(options::OFLAG) Arg::new(options::OFLAG)
.long(options::OFLAG) .long(options::OFLAG)
.takes_value(true) .takes_value(true)
.require_equals(true) .require_equals(true)

View file

@ -311,6 +311,6 @@ fn test_nocreat_causes_failure_when_ofile_doesnt_exist() {
String::from("--of=not-a-real.file"), String::from("--of=not-a-real.file"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let _ = Output::<File>::new(&matches).unwrap(); let _ = Output::<File>::new(&matches).unwrap();
} }

View file

@ -13,7 +13,7 @@ use super::*;
use std::error::Error; use std::error::Error;
use uucore::error::UError; use uucore::error::UError;
pub type Matches = clap::ArgMatches<'static>; pub type Matches = ArgMatches;
/// Parser Errors describe errors with parser input /// Parser Errors describe errors with parser input
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]

View file

@ -25,7 +25,7 @@ fn unimplemented_flags_should_error_non_linux() {
format!("--iflag={}", flag), format!("--iflag={}", flag),
format!("--oflag={}", flag), format!("--oflag={}", flag),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
if parse_iflags(&matches).is_ok() { if parse_iflags(&matches).is_ok() {
succeeded.push(format!("iflag={}", flag)); succeeded.push(format!("iflag={}", flag));
@ -53,7 +53,7 @@ fn unimplemented_flags_should_error() {
format!("--iflag={}", flag), format!("--iflag={}", flag),
format!("--oflag={}", flag), format!("--oflag={}", flag),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
if parse_iflags(&matches).is_ok() { if parse_iflags(&matches).is_ok() {
succeeded.push(format!("iflag={}", flag)) succeeded.push(format!("iflag={}", flag))
@ -78,7 +78,7 @@ fn test_status_level_absent() {
String::from("--of=bar.file"), String::from("--of=bar.file"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let st = parse_status_level(&matches).unwrap(); let st = parse_status_level(&matches).unwrap();
assert_eq!(st, None); assert_eq!(st, None);
@ -93,7 +93,7 @@ fn test_status_level_none() {
String::from("--of=bar.file"), String::from("--of=bar.file"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let st = parse_status_level(&matches).unwrap().unwrap(); let st = parse_status_level(&matches).unwrap().unwrap();
assert_eq!(st, StatusLevel::None); assert_eq!(st, StatusLevel::None);
@ -121,7 +121,7 @@ fn test_all_top_level_args_no_leading_dashes() {
.into_iter() .into_iter()
.fold(Vec::new(), append_dashes_if_not_present); .fold(Vec::new(), append_dashes_if_not_present);
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
assert_eq!(100, parse_ibs(&matches).unwrap()); assert_eq!(100, parse_ibs(&matches).unwrap());
assert_eq!(100, parse_obs(&matches).unwrap()); assert_eq!(100, parse_obs(&matches).unwrap());
@ -205,7 +205,7 @@ fn test_all_top_level_args_with_leading_dashes() {
.into_iter() .into_iter()
.fold(Vec::new(), append_dashes_if_not_present); .fold(Vec::new(), append_dashes_if_not_present);
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
assert_eq!(100, parse_ibs(&matches).unwrap()); assert_eq!(100, parse_ibs(&matches).unwrap());
assert_eq!(100, parse_obs(&matches).unwrap()); assert_eq!(100, parse_obs(&matches).unwrap());
@ -276,7 +276,7 @@ fn test_status_level_progress() {
String::from("--status=progress"), String::from("--status=progress"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let st = parse_status_level(&matches).unwrap().unwrap(); let st = parse_status_level(&matches).unwrap().unwrap();
assert_eq!(st, StatusLevel::Progress); assert_eq!(st, StatusLevel::Progress);
@ -291,7 +291,7 @@ fn test_status_level_noxfer() {
String::from("--of=bar.file"), String::from("--of=bar.file"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let st = parse_status_level(&matches).unwrap().unwrap(); let st = parse_status_level(&matches).unwrap().unwrap();
assert_eq!(st, StatusLevel::Noxfer); assert_eq!(st, StatusLevel::Noxfer);
@ -304,7 +304,7 @@ fn test_status_level_noxfer() {
fn icf_ctable_error() { fn icf_ctable_error() {
let args = vec![String::from("dd"), String::from("--conv=ascii,ebcdic,ibm")]; let args = vec![String::from("dd"), String::from("--conv=ascii,ebcdic,ibm")];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let _ = parse_conv_flag_input(&matches).unwrap(); let _ = parse_conv_flag_input(&matches).unwrap();
} }
@ -314,7 +314,7 @@ fn icf_ctable_error() {
fn icf_case_error() { fn icf_case_error() {
let args = vec![String::from("dd"), String::from("--conv=ucase,lcase")]; let args = vec![String::from("dd"), String::from("--conv=ucase,lcase")];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let _ = parse_conv_flag_input(&matches).unwrap(); let _ = parse_conv_flag_input(&matches).unwrap();
} }
@ -324,7 +324,7 @@ fn icf_case_error() {
fn icf_block_error() { fn icf_block_error() {
let args = vec![String::from("dd"), String::from("--conv=block,unblock")]; let args = vec![String::from("dd"), String::from("--conv=block,unblock")];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let _ = parse_conv_flag_input(&matches).unwrap(); let _ = parse_conv_flag_input(&matches).unwrap();
} }
@ -334,7 +334,7 @@ fn icf_block_error() {
fn icf_creat_error() { fn icf_creat_error() {
let args = vec![String::from("dd"), String::from("--conv=excl,nocreat")]; let args = vec![String::from("dd"), String::from("--conv=excl,nocreat")];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let _ = parse_conv_flag_output(&matches).unwrap(); let _ = parse_conv_flag_output(&matches).unwrap();
} }
@ -344,7 +344,7 @@ fn parse_icf_token_ibm() {
let exp = vec![ConvFlag::FmtAtoI]; let exp = vec![ConvFlag::FmtAtoI];
let args = vec![String::from("dd"), String::from("--conv=ibm")]; let args = vec![String::from("dd"), String::from("--conv=ibm")];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<ConvFlag>("conv", &matches).unwrap(); let act = parse_flag_list::<ConvFlag>("conv", &matches).unwrap();
@ -362,7 +362,7 @@ fn parse_icf_tokens_elu() {
String::from("dd"), String::from("dd"),
String::from("--conv=ebcdic,lcase,unblock"), String::from("--conv=ebcdic,lcase,unblock"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<ConvFlag>("conv", &matches).unwrap(); let act = parse_flag_list::<ConvFlag>("conv", &matches).unwrap();
assert_eq!(exp.len(), act.len()); assert_eq!(exp.len(), act.len());
@ -393,7 +393,7 @@ fn parse_icf_tokens_remaining() {
String::from("dd"), String::from("dd"),
String::from("--conv=ascii,ucase,block,sparse,swab,sync,noerror,excl,nocreat,notrunc,noerror,fdatasync,fsync"), String::from("--conv=ascii,ucase,block,sparse,swab,sync,noerror,excl,nocreat,notrunc,noerror,fdatasync,fsync"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<ConvFlag>("conv", &matches).unwrap(); let act = parse_flag_list::<ConvFlag>("conv", &matches).unwrap();
@ -417,7 +417,7 @@ fn parse_iflag_tokens() {
String::from("dd"), String::from("dd"),
String::from("--iflag=fullblock,count_bytes,skip_bytes,append,seek_bytes"), String::from("--iflag=fullblock,count_bytes,skip_bytes,append,seek_bytes"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<Flag>("iflag", &matches).unwrap(); let act = parse_flag_list::<Flag>("iflag", &matches).unwrap();
@ -441,7 +441,7 @@ fn parse_oflag_tokens() {
String::from("dd"), String::from("dd"),
String::from("--oflag=fullblock,count_bytes,skip_bytes,append,seek_bytes"), String::from("--oflag=fullblock,count_bytes,skip_bytes,append,seek_bytes"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<Flag>("oflag", &matches).unwrap(); let act = parse_flag_list::<Flag>("oflag", &matches).unwrap();
@ -469,7 +469,7 @@ fn parse_iflag_tokens_linux() {
String::from("dd"), String::from("dd"),
String::from("--iflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow"), String::from("--iflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<Flag>("iflag", &matches).unwrap(); let act = parse_flag_list::<Flag>("iflag", &matches).unwrap();
@ -497,7 +497,7 @@ fn parse_oflag_tokens_linux() {
String::from("dd"), String::from("dd"),
String::from("--oflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow"), String::from("--oflag=direct,directory,dsync,sync,nonblock,noatime,noctty,nofollow"),
]; ];
let matches = uu_app().get_matches_from_safe(args).unwrap(); let matches = uu_app().try_get_matches_from(args).unwrap();
let act = parse_flag_list::<Flag>("oflag", &matches).unwrap(); let act = parse_flag_list::<Flag>("oflag", &matches).unwrap();

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/df.rs" path = "src/df.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
number_prefix = "0.4" number_prefix = "0.4"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["libc", "fsext"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["libc", "fsext"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -280,7 +280,7 @@ impl UError for DfError {
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 paths: Vec<String> = matches let paths: Vec<String> = matches
.values_of(OPT_PATHS) .values_of(OPT_PATHS)
@ -421,19 +421,19 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(OPT_ALL) Arg::new(OPT_ALL)
.short("a") .short('a')
.long("all") .long("all")
.help("include dummy file systems"), .help("include dummy file systems"),
) )
.arg( .arg(
Arg::with_name(OPT_BLOCKSIZE) Arg::new(OPT_BLOCKSIZE)
.short("B") .short('B')
.long("block-size") .long("block-size")
.takes_value(true) .takes_value(true)
.help( .help(
@ -442,54 +442,50 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_DIRECT) Arg::new(OPT_DIRECT)
.long("direct") .long("direct")
.help("show statistics for a file instead of mount point"), .help("show statistics for a file instead of mount point"),
) )
.arg( .arg(
Arg::with_name(OPT_TOTAL) Arg::new(OPT_TOTAL)
.long("total") .long("total")
.help("produce a grand total"), .help("produce a grand total"),
) )
.arg( .arg(
Arg::with_name(OPT_HUMAN_READABLE) Arg::new(OPT_HUMAN_READABLE)
.short("h") .short('h')
.long("human-readable") .long("human-readable")
.conflicts_with(OPT_HUMAN_READABLE_2) .conflicts_with(OPT_HUMAN_READABLE_2)
.help("print sizes in human readable format (e.g., 1K 234M 2G)"), .help("print sizes in human readable format (e.g., 1K 234M 2G)"),
) )
.arg( .arg(
Arg::with_name(OPT_HUMAN_READABLE_2) Arg::new(OPT_HUMAN_READABLE_2)
.short("H") .short('H')
.long("si") .long("si")
.conflicts_with(OPT_HUMAN_READABLE) .conflicts_with(OPT_HUMAN_READABLE)
.help("likewise, but use powers of 1000 not 1024"), .help("likewise, but use powers of 1000 not 1024"),
) )
.arg( .arg(
Arg::with_name(OPT_INODES) Arg::new(OPT_INODES)
.short("i") .short('i')
.long("inodes") .long("inodes")
.help("list inode information instead of block usage"), .help("list inode information instead of block usage"),
) )
.arg(Arg::new(OPT_KILO).short('k').help("like --block-size=1K"))
.arg( .arg(
Arg::with_name(OPT_KILO) Arg::new(OPT_LOCAL)
.short("k") .short('l')
.help("like --block-size=1K"),
)
.arg(
Arg::with_name(OPT_LOCAL)
.short("l")
.long("local") .long("local")
.help("limit listing to local file systems"), .help("limit listing to local file systems"),
) )
.arg( .arg(
Arg::with_name(OPT_NO_SYNC) Arg::new(OPT_NO_SYNC)
.long("no-sync") .long("no-sync")
.conflicts_with(OPT_SYNC) .conflicts_with(OPT_SYNC)
.help("do not invoke sync before getting usage info (default)"), .help("do not invoke sync before getting usage info (default)"),
) )
.arg( .arg(
Arg::with_name(OPT_OUTPUT) Arg::new(OPT_OUTPUT)
.long("output") .long("output")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_delimiter(true)
@ -499,39 +495,40 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_PORTABILITY) Arg::new(OPT_PORTABILITY)
.short("P") .short('P')
.long("portability") .long("portability")
.help("use the POSIX output format"), .help("use the POSIX output format"),
) )
.arg( .arg(
Arg::with_name(OPT_SYNC) Arg::new(OPT_SYNC)
.long("sync") .long("sync")
.conflicts_with(OPT_NO_SYNC) .conflicts_with(OPT_NO_SYNC)
.help("invoke sync before getting usage info"), .help("invoke sync before getting usage info"),
) )
.arg( .arg(
Arg::with_name(OPT_TYPE) Arg::new(OPT_TYPE)
.short("t") .short('t')
.long("type") .long("type")
.allow_invalid_utf8(true)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_delimiter(true)
.help("limit listing to file systems of type TYPE"), .help("limit listing to file systems of type TYPE"),
) )
.arg( .arg(
Arg::with_name(OPT_PRINT_TYPE) Arg::new(OPT_PRINT_TYPE)
.short("T") .short('T')
.long("print-type") .long("print-type")
.help("print file system type"), .help("print file system type"),
) )
.arg( .arg(
Arg::with_name(OPT_EXCLUDE_TYPE) Arg::new(OPT_EXCLUDE_TYPE)
.short("x") .short('x')
.long("exclude-type") .long("exclude-type")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_delimiter(true)
.help("limit listing to file systems not of type TYPE"), .help("limit listing to file systems not of type TYPE"),
) )
.arg(Arg::with_name(OPT_PATHS).multiple(true)) .arg(Arg::new(OPT_PATHS).multiple_occurrences(true))
.help("Filesystem(s) to list") .override_help("Filesystem(s) to list")
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/dircolors.rs" path = "src/dircolors.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
glob = "0.3.0" glob = "0.3.0"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -73,7 +73,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 files = matches let files = matches
.values_of(options::FILE) .values_of(options::FILE)
@ -160,35 +160,39 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.arg( .arg(
Arg::with_name(options::BOURNE_SHELL) Arg::new(options::BOURNE_SHELL)
.long("sh") .long("sh")
.short("b") .short('b')
.visible_alias("bourne-shell") .visible_alias("bourne-shell")
.help("output Bourne shell code to set LS_COLORS") .help("output Bourne shell code to set LS_COLORS")
.display_order(1), .display_order(1),
) )
.arg( .arg(
Arg::with_name(options::C_SHELL) Arg::new(options::C_SHELL)
.long("csh") .long("csh")
.short("c") .short('c')
.visible_alias("c-shell") .visible_alias("c-shell")
.help("output C shell code to set LS_COLORS") .help("output C shell code to set LS_COLORS")
.display_order(2), .display_order(2),
) )
.arg( .arg(
Arg::with_name(options::PRINT_DATABASE) Arg::new(options::PRINT_DATABASE)
.long("print-database") .long("print-database")
.short("p") .short('p')
.help("print the byte counts") .help("print the byte counts")
.display_order(3), .display_order(3),
) )
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .arg(
Arg::new(options::FILE)
.hide(true)
.multiple_occurrences(true),
)
} }
pub trait StrUtils { pub trait StrUtils {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/dirname.rs" path = "src/dirname.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -39,7 +39,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let after_help = get_long_usage(); let after_help = get_long_usage();
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&after_help[..]) .after_help(&after_help[..])
.get_matches_from(args); .get_matches_from(args);
@ -83,15 +83,15 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.about(ABOUT) .about(ABOUT)
.version(crate_version!()) .version(crate_version!())
.arg( .arg(
Arg::with_name(options::ZERO) Arg::new(options::ZERO)
.long(options::ZERO) .long(options::ZERO)
.short("z") .short('z')
.help("separate output with NUL rather than newline"), .help("separate output with NUL rather than newline"),
) )
.arg(Arg::with_name(options::DIR).hidden(true).multiple(true)) .arg(Arg::new(options::DIR).hide(true).multiple_occurrences(true))
} }

View file

@ -15,8 +15,8 @@ edition = "2018"
path = "src/du.rs" path = "src/du.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
chrono = "^0.4.11" chrono = "^0.4.11"
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -462,7 +462,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 summarize = matches.is_present(options::SUMMARIZE); let summarize = matches.is_present(options::SUMMARIZE);
@ -625,19 +625,19 @@ fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult<Option<u
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.arg( .arg(
Arg::with_name(options::ALL) Arg::new(options::ALL)
.short("a") .short('a')
.long(options::ALL) .long(options::ALL)
.help("write counts for all files, not just directories"), .help("write counts for all files, not just directories"),
) )
.arg( .arg(
Arg::with_name(options::APPARENT_SIZE) Arg::new(options::APPARENT_SIZE)
.long(options::APPARENT_SIZE) .long(options::APPARENT_SIZE)
.help( .help(
"print apparent sizes, rather than disk usage \ "print apparent sizes, rather than disk usage \
@ -647,8 +647,8 @@ pub fn uu_app() -> App<'static, 'static> {
.alias("app") // The GNU test suite uses this alias .alias("app") // The GNU test suite uses this alias
) )
.arg( .arg(
Arg::with_name(options::BLOCK_SIZE) Arg::new(options::BLOCK_SIZE)
.short("B") .short('B')
.long(options::BLOCK_SIZE) .long(options::BLOCK_SIZE)
.value_name("SIZE") .value_name("SIZE")
.help( .help(
@ -657,20 +657,20 @@ pub fn uu_app() -> App<'static, 'static> {
) )
) )
.arg( .arg(
Arg::with_name(options::BYTES) Arg::new(options::BYTES)
.short("b") .short('b')
.long("bytes") .long("bytes")
.help("equivalent to '--apparent-size --block-size=1'") .help("equivalent to '--apparent-size --block-size=1'")
) )
.arg( .arg(
Arg::with_name(options::TOTAL) Arg::new(options::TOTAL)
.long("total") .long("total")
.short("c") .short('c')
.help("produce a grand total") .help("produce a grand total")
) )
.arg( .arg(
Arg::with_name(options::MAX_DEPTH) Arg::new(options::MAX_DEPTH)
.short("d") .short('d')
.long("max-depth") .long("max-depth")
.value_name("N") .value_name("N")
.help( .help(
@ -680,78 +680,78 @@ pub fn uu_app() -> App<'static, 'static> {
) )
) )
.arg( .arg(
Arg::with_name(options::HUMAN_READABLE) Arg::new(options::HUMAN_READABLE)
.long("human-readable") .long("human-readable")
.short("h") .short('h')
.help("print sizes in human readable format (e.g., 1K 234M 2G)") .help("print sizes in human readable format (e.g., 1K 234M 2G)")
) )
.arg( .arg(
Arg::with_name(options::INODES) Arg::new(options::INODES)
.long(options::INODES) .long(options::INODES)
.help( .help(
"list inode usage information instead of block usage like --block-size=1K" "list inode usage information instead of block usage like --block-size=1K"
) )
) )
.arg( .arg(
Arg::with_name(options::BLOCK_SIZE_1K) Arg::new(options::BLOCK_SIZE_1K)
.short("k") .short('k')
.help("like --block-size=1K") .help("like --block-size=1K")
) )
.arg( .arg(
Arg::with_name(options::COUNT_LINKS) Arg::new(options::COUNT_LINKS)
.short("l") .short('l')
.long("count-links") .long("count-links")
.help("count sizes many times if hard linked") .help("count sizes many times if hard linked")
) )
.arg( .arg(
Arg::with_name(options::DEREFERENCE) Arg::new(options::DEREFERENCE)
.short("L") .short('L')
.long(options::DEREFERENCE) .long(options::DEREFERENCE)
.help("dereference all symbolic links") .help("dereference all symbolic links")
) )
// .arg( // .arg(
// Arg::with_name("no-dereference") // Arg::new("no-dereference")
// .short("P") // .short('P')
// .long("no-dereference") // .long("no-dereference")
// .help("don't follow any symbolic links (this is the default)") // .help("don't follow any symbolic links (this is the default)")
// ) // )
.arg( .arg(
Arg::with_name(options::BLOCK_SIZE_1M) Arg::new(options::BLOCK_SIZE_1M)
.short("m") .short('m')
.help("like --block-size=1M") .help("like --block-size=1M")
) )
.arg( .arg(
Arg::with_name(options::NULL) Arg::new(options::NULL)
.short("0") .short('0')
.long("null") .long("null")
.help("end each output line with 0 byte rather than newline") .help("end each output line with 0 byte rather than newline")
) )
.arg( .arg(
Arg::with_name(options::SEPARATE_DIRS) Arg::new(options::SEPARATE_DIRS)
.short("S") .short('S')
.long("separate-dirs") .long("separate-dirs")
.help("do not include size of subdirectories") .help("do not include size of subdirectories")
) )
.arg( .arg(
Arg::with_name(options::SUMMARIZE) Arg::new(options::SUMMARIZE)
.short("s") .short('s')
.long("summarize") .long("summarize")
.help("display only a total for each argument") .help("display only a total for each argument")
) )
.arg( .arg(
Arg::with_name(options::SI) Arg::new(options::SI)
.long(options::SI) .long(options::SI)
.help("like -h, but use powers of 1000 not 1024") .help("like -h, but use powers of 1000 not 1024")
) )
.arg( .arg(
Arg::with_name(options::ONE_FILE_SYSTEM) Arg::new(options::ONE_FILE_SYSTEM)
.short("x") .short('x')
.long(options::ONE_FILE_SYSTEM) .long(options::ONE_FILE_SYSTEM)
.help("skip directories on different file systems") .help("skip directories on different file systems")
) )
.arg( .arg(
Arg::with_name(options::THRESHOLD) Arg::new(options::THRESHOLD)
.short("t") .short('t')
.long(options::THRESHOLD) .long(options::THRESHOLD)
.alias("th") .alias("th")
.value_name("SIZE") .value_name("SIZE")
@ -761,20 +761,20 @@ pub fn uu_app() -> App<'static, 'static> {
or entries greater than SIZE if negative") or entries greater than SIZE if negative")
) )
// .arg( // .arg(
// Arg::with_name("") // Arg::new("")
// .short("x") // .short('x')
// .long("exclude-from") // .long("exclude-from")
// .value_name("FILE") // .value_name("FILE")
// .help("exclude files that match any pattern in FILE") // .help("exclude files that match any pattern in FILE")
// ) // )
// .arg( // .arg(
// Arg::with_name("exclude") // Arg::new("exclude")
// .long("exclude") // .long("exclude")
// .value_name("PATTERN") // .value_name("PATTERN")
// .help("exclude files that match PATTERN") // .help("exclude files that match PATTERN")
// ) // )
.arg( .arg(
Arg::with_name(options::TIME) Arg::new(options::TIME)
.long(options::TIME) .long(options::TIME)
.value_name("WORD") .value_name("WORD")
.require_equals(true) .require_equals(true)
@ -787,7 +787,7 @@ pub fn uu_app() -> App<'static, 'static> {
) )
) )
.arg( .arg(
Arg::with_name(options::TIME_STYLE) Arg::new(options::TIME_STYLE)
.long(options::TIME_STYLE) .long(options::TIME_STYLE)
.value_name("STYLE") .value_name("STYLE")
.help( .help(
@ -796,9 +796,9 @@ pub fn uu_app() -> App<'static, 'static> {
) )
) )
.arg( .arg(
Arg::with_name(options::FILE) Arg::new(options::FILE)
.hidden(true) .hide(true)
.multiple(true) .multiple_occurrences(true)
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/echo.rs" path = "src/echo.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -128,44 +128,37 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
execute(no_newline, escaped, values).map_err_context(|| "could not write to stdout".to_string()) execute(no_newline, escaped, values).map_err_context(|| "could not write to stdout".to_string())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
// TrailingVarArg specifies the final positional argument is a VarArg // TrailingVarArg specifies the final positional argument is a VarArg
// and it doesn't attempts the parse any further args. // and it doesn't attempts the parse any further args.
// Final argument must have multiple(true) or the usage string equivalent. // Final argument must have multiple(true) or the usage string equivalent.
.setting(clap::AppSettings::TrailingVarArg) .setting(clap::AppSettings::TrailingVarArg)
.setting(clap::AppSettings::AllowLeadingHyphen) .setting(clap::AppSettings::AllowHyphenValues)
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.after_help(AFTER_HELP) .after_help(AFTER_HELP)
.usage(USAGE) .override_usage(USAGE)
.arg( .arg(
Arg::with_name(options::NO_NEWLINE) Arg::new(options::NO_NEWLINE)
.short("n") .short('n')
.help("do not output the trailing newline") .help("do not output the trailing newline")
.takes_value(false) .takes_value(false),
.display_order(1),
) )
.arg( .arg(
Arg::with_name(options::ENABLE_BACKSLASH_ESCAPE) Arg::new(options::ENABLE_BACKSLASH_ESCAPE)
.short("e") .short('e')
.help("enable interpretation of backslash escapes") .help("enable interpretation of backslash escapes")
.takes_value(false) .takes_value(false),
.display_order(2),
) )
.arg( .arg(
Arg::with_name(options::DISABLE_BACKSLASH_ESCAPE) Arg::new(options::DISABLE_BACKSLASH_ESCAPE)
.short("E") .short('E')
.help("disable interpretation of backslash escapes (default)") .help("disable interpretation of backslash escapes (default)")
.takes_value(false) .takes_value(false),
.display_order(3),
)
.arg(
Arg::with_name(options::STRING)
.multiple(true)
.allow_hyphen_values(true),
) )
.arg(Arg::new(options::STRING).multiple_occurrences(true))
} }
fn execute(no_newline: bool, escaped: bool, free: Vec<String>) -> io::Result<()> { fn execute(no_newline: bool, escaped: bool, free: Vec<String>) -> io::Result<()> {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/env.rs" path = "src/env.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
rust-ini = "0.17.0" rust-ini = "0.17.0"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

30
src/uu/env/src/env.rs vendored
View file

@ -119,46 +119,46 @@ fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b
(progname, &args[..]) (progname, &args[..])
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(crate_name!()) App::new(crate_name!())
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
.usage(USAGE) .override_usage(USAGE)
.after_help(AFTER_HELP) .after_help(AFTER_HELP)
.setting(AppSettings::AllowExternalSubcommands) .setting(AppSettings::AllowExternalSubcommands)
.arg(Arg::with_name("ignore-environment") .arg(Arg::new("ignore-environment")
.short("i") .short('i')
.long("ignore-environment") .long("ignore-environment")
.help("start with an empty environment")) .help("start with an empty environment"))
.arg(Arg::with_name("chdir") .arg(Arg::new("chdir")
.short("C") // GNU env compatibility .short('C') // GNU env compatibility
.long("chdir") .long("chdir")
.takes_value(true) .takes_value(true)
.number_of_values(1) .number_of_values(1)
.value_name("DIR") .value_name("DIR")
.help("change working directory to DIR")) .help("change working directory to DIR"))
.arg(Arg::with_name("null") .arg(Arg::new("null")
.short("0") .short('0')
.long("null") .long("null")
.help("end each output line with a 0 byte rather than a newline (only valid when \ .help("end each output line with a 0 byte rather than a newline (only valid when \
printing the environment)")) printing the environment)"))
.arg(Arg::with_name("file") .arg(Arg::new("file")
.short("f") .short('f')
.long("file") .long("file")
.takes_value(true) .takes_value(true)
.number_of_values(1) .number_of_values(1)
.value_name("PATH") .value_name("PATH")
.multiple(true) .multiple_occurrences(true)
.help("read and set variables from a \".env\"-style configuration file (prior to any \ .help("read and set variables from a \".env\"-style configuration file (prior to any \
unset and/or set)")) unset and/or set)"))
.arg(Arg::with_name("unset") .arg(Arg::new("unset")
.short("u") .short('u')
.long("unset") .long("unset")
.takes_value(true) .takes_value(true)
.number_of_values(1) .number_of_values(1)
.value_name("NAME") .value_name("NAME")
.multiple(true) .multiple_occurrences(true)
.help("remove variable from the environment")) .help("remove variable from the environment"))
} }
@ -203,7 +203,7 @@ fn run_env(args: impl uucore::Args) -> UResult<()> {
// we handle the name, value pairs and the program to be executed by treating them as external // we handle the name, value pairs and the program to be executed by treating them as external
// subcommands in clap // subcommands in clap
if let (external, Some(matches)) = matches.subcommand() { if let Some((external, matches)) = matches.subcommand() {
let mut begin_prog_opts = false; let mut begin_prog_opts = false;
if external == "-" { if external == "-" {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/expand.rs" path = "src/expand.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
unicode-width = "0.1.5" unicode-width = "0.1.5"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -174,39 +174,39 @@ impl Options {
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
expand(Options::new(&matches)).map_err_context(|| "failed to write output".to_string()) expand(Options::new(&matches)).map_err_context(|| "failed to write output".to_string())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.arg( .arg(
Arg::with_name(options::INITIAL) Arg::new(options::INITIAL)
.long(options::INITIAL) .long(options::INITIAL)
.short("i") .short('i')
.help("do not convert tabs after non blanks"), .help("do not convert tabs after non blanks"),
) )
.arg( .arg(
Arg::with_name(options::TABS) Arg::new(options::TABS)
.long(options::TABS) .long(options::TABS)
.short("t") .short('t')
.value_name("N, LIST") .value_name("N, LIST")
.takes_value(true) .takes_value(true)
.help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"),
) )
.arg( .arg(
Arg::with_name(options::NO_UTF8) Arg::new(options::NO_UTF8)
.long(options::NO_UTF8) .long(options::NO_UTF8)
.short("U") .short('U')
.help("interpret input file as 8-bit ASCII rather than UTF-8"), .help("interpret input file as 8-bit ASCII rather than UTF-8"),
).arg( ).arg(
Arg::with_name(options::FILES) Arg::new(options::FILES)
.multiple(true) .multiple_occurrences(true)
.hidden(true) .hide(true)
.takes_value(true) .takes_value(true)
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/expr.rs" path = "src/expr.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
num-bigint = "0.4.0" num-bigint = "0.4.0"
num-traits = "0.2.14" num-traits = "0.2.14"

View file

@ -15,10 +15,10 @@ mod tokens;
const VERSION: &str = "version"; const VERSION: &str = "version";
const HELP: &str = "help"; const HELP: &str = "help";
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.arg(Arg::with_name(VERSION).long(VERSION)) .arg(Arg::new(VERSION).long(VERSION))
.arg(Arg::with_name(HELP).long(HELP)) .arg(Arg::new(HELP).long(HELP))
} }
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]

View file

@ -15,7 +15,7 @@ edition = "2018"
num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
coz = { version = "0.1.3", optional = true } coz = { version = "0.1.3", optional = true }
num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd"
rand = { version = "0.7", features = ["small_rng"] } rand = { version = "0.7", features = ["small_rng"] }

View file

@ -77,9 +77,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.arg(Arg::with_name(options::NUMBER).multiple(true)) .arg(Arg::new(options::NUMBER).multiple_occurrences(true))
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/false.rs" path = "src/false.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -14,6 +14,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Err(1.into()) Err(1.into())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/fmt.rs" path = "src/fmt.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
unicode-width = "0.1.5" unicode-width = "0.1.5"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

View file

@ -71,7 +71,7 @@ pub struct FmtOptions {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 files: Vec<String> = matches let mut files: Vec<String> = matches
.values_of(ARG_FILES) .values_of(ARG_FILES)
@ -222,13 +222,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(OPT_CROWN_MARGIN) Arg::new(OPT_CROWN_MARGIN)
.short("c") .short('c')
.long(OPT_CROWN_MARGIN) .long(OPT_CROWN_MARGIN)
.help( .help(
"First and second line of paragraph \ "First and second line of paragraph \
@ -238,8 +238,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_TAGGED_PARAGRAPH) Arg::new(OPT_TAGGED_PARAGRAPH)
.short("t") .short('t')
.long("tagged-paragraph") .long("tagged-paragraph")
.help( .help(
"Like -c, except that the first and second line of a paragraph *must* \ "Like -c, except that the first and second line of a paragraph *must* \
@ -247,8 +247,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_PRESERVE_HEADERS) Arg::new(OPT_PRESERVE_HEADERS)
.short("m") .short('m')
.long("preserve-headers") .long("preserve-headers")
.help( .help(
"Attempt to detect and preserve mail headers in the input. \ "Attempt to detect and preserve mail headers in the input. \
@ -256,14 +256,14 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_SPLIT_ONLY) Arg::new(OPT_SPLIT_ONLY)
.short("s") .short('s')
.long("split-only") .long("split-only")
.help("Split lines only, do not reflow."), .help("Split lines only, do not reflow."),
) )
.arg( .arg(
Arg::with_name(OPT_UNIFORM_SPACING) Arg::new(OPT_UNIFORM_SPACING)
.short("u") .short('u')
.long("uniform-spacing") .long("uniform-spacing")
.help( .help(
"Insert exactly one \ "Insert exactly one \
@ -274,8 +274,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_PREFIX) Arg::new(OPT_PREFIX)
.short("p") .short('p')
.long("prefix") .long("prefix")
.help( .help(
"Reformat only lines \ "Reformat only lines \
@ -286,8 +286,8 @@ pub fn uu_app() -> App<'static, 'static> {
.value_name("PREFIX"), .value_name("PREFIX"),
) )
.arg( .arg(
Arg::with_name(OPT_SKIP_PREFIX) Arg::new(OPT_SKIP_PREFIX)
.short("P") .short('P')
.long("skip-prefix") .long("skip-prefix")
.help( .help(
"Do not reformat lines \ "Do not reformat lines \
@ -297,8 +297,8 @@ pub fn uu_app() -> App<'static, 'static> {
.value_name("PSKIP"), .value_name("PSKIP"),
) )
.arg( .arg(
Arg::with_name(OPT_EXACT_PREFIX) Arg::new(OPT_EXACT_PREFIX)
.short("x") .short('x')
.long("exact-prefix") .long("exact-prefix")
.help( .help(
"PREFIX must match at the \ "PREFIX must match at the \
@ -306,8 +306,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_EXACT_SKIP_PREFIX) Arg::new(OPT_EXACT_SKIP_PREFIX)
.short("X") .short('X')
.long("exact-skip-prefix") .long("exact-skip-prefix")
.help( .help(
"PSKIP must match at the \ "PSKIP must match at the \
@ -315,26 +315,26 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_WIDTH) Arg::new(OPT_WIDTH)
.short("w") .short('w')
.long("width") .long("width")
.help("Fill output lines up to a maximum of WIDTH columns, default 79.") .help("Fill output lines up to a maximum of WIDTH columns, default 79.")
.value_name("WIDTH"), .value_name("WIDTH"),
) )
.arg( .arg(
Arg::with_name(OPT_GOAL) Arg::new(OPT_GOAL)
.short("g") .short('g')
.long("goal") .long("goal")
.help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.") .help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.")
.value_name("GOAL"), .value_name("GOAL"),
) )
.arg(Arg::with_name(OPT_QUICK).short("q").long("quick").help( .arg(Arg::new(OPT_QUICK).short('q').long("quick").help(
"Break lines more quickly at the \ "Break lines more quickly at the \
expense of a potentially more ragged appearance.", expense of a potentially more ragged appearance.",
)) ))
.arg( .arg(
Arg::with_name(OPT_TAB_WIDTH) Arg::new(OPT_TAB_WIDTH)
.short("T") .short('T')
.long("tab-width") .long("tab-width")
.help( .help(
"Treat tabs as TABWIDTH spaces for \ "Treat tabs as TABWIDTH spaces for \
@ -343,5 +343,9 @@ pub fn uu_app() -> App<'static, 'static> {
) )
.value_name("TABWIDTH"), .value_name("TABWIDTH"),
) )
.arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .arg(
Arg::new(ARG_FILES)
.multiple_occurrences(true)
.takes_value(true),
)
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/fold.rs" path = "src/fold.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -63,16 +63,16 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
fold(files, bytes, spaces, width) fold(files, bytes, spaces, width)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.usage(SYNTAX) .override_usage(SYNTAX)
.about(SUMMARY) .about(SUMMARY)
.arg( .arg(
Arg::with_name(options::BYTES) Arg::new(options::BYTES)
.long(options::BYTES) .long(options::BYTES)
.short("b") .short('b')
.help( .help(
"count using bytes rather than columns (meaning control characters \ "count using bytes rather than columns (meaning control characters \
such as newline are not treated specially)", such as newline are not treated specially)",
@ -80,22 +80,26 @@ pub fn uu_app() -> App<'static, 'static> {
.takes_value(false), .takes_value(false),
) )
.arg( .arg(
Arg::with_name(options::SPACES) Arg::new(options::SPACES)
.long(options::SPACES) .long(options::SPACES)
.short("s") .short('s')
.help("break lines at word boundaries rather than a hard cut-off") .help("break lines at word boundaries rather than a hard cut-off")
.takes_value(false), .takes_value(false),
) )
.arg( .arg(
Arg::with_name(options::WIDTH) Arg::new(options::WIDTH)
.long(options::WIDTH) .long(options::WIDTH)
.short("w") .short('w')
.help("set WIDTH as the maximum line width rather than 80") .help("set WIDTH as the maximum line width rather than 80")
.value_name("WIDTH") .value_name("WIDTH")
.allow_hyphen_values(true) .allow_hyphen_values(true)
.takes_value(true), .takes_value(true),
) )
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .arg(
Arg::new(options::FILE)
.hide(true)
.multiple_occurrences(true),
)
} }
fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) { fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {

View file

@ -15,9 +15,9 @@ edition = "2018"
path = "src/groups.rs" path = "src/groups.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "process"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "process"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
clap = { version = "2.33", features = ["wrap_help"] }
[[bin]] [[bin]]
name = "groups" name = "groups"

View file

@ -73,7 +73,7 @@ fn infallible_gid2grp(gid: &u32) -> String {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 users: Vec<String> = matches let users: Vec<String> = matches
.values_of(options::USERS) .values_of(options::USERS)
@ -105,13 +105,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::USERS) Arg::new(options::USERS)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.value_name(options::USERS), .value_name(options::USERS),
) )

View file

@ -16,7 +16,7 @@ path = "src/hashsum.rs"
[dependencies] [dependencies]
digest = "0.6.1" digest = "0.6.1"
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
hex = "0.2.0" hex = "0.2.0"
libc = "0.2.42" libc = "0.2.42"
memchr = "2" memchr = "2"

View file

@ -74,9 +74,9 @@ fn is_custom_binary(program: &str) -> bool {
} }
#[allow(clippy::cognitive_complexity)] #[allow(clippy::cognitive_complexity)]
fn detect_algo<'a>( fn detect_algo(
program: &str, program: &str,
matches: &ArgMatches<'a>, matches: &ArgMatches,
) -> (&'static str, Box<dyn Digest + 'static>, usize) { ) -> (&'static str, Box<dyn Digest + 'static>, usize) {
let mut alg: Option<Box<dyn Digest>> = None; let mut alg: Option<Box<dyn Digest>> = None;
let mut name: &'static str = ""; let mut name: &'static str = "";
@ -270,10 +270,8 @@ fn parse_bit_num(arg: &str) -> Result<usize, ParseIntError> {
arg.parse() arg.parse()
} }
fn is_valid_bit_num(arg: String) -> Result<(), String> { fn is_valid_bit_num(arg: &str) -> Result<(), String> {
parse_bit_num(&arg) parse_bit_num(arg).map(|_| ()).map_err(|e| format!("{}", e))
.map(|_| ())
.map_err(|e| format!("{}", e))
} }
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
@ -292,7 +290,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
let app = uu_app(&binary_name); let app = uu_app(&binary_name);
// FIXME: this should use get_matches_from_safe() and crash!(), but at the moment that just // FIXME: this should use try_get_matches_from() and crash!(), but at the moment that just
// causes "error: " to be printed twice (once from crash!() and once from clap). With // causes "error: " to be printed twice (once from crash!() and once from clap). With
// the current setup, the name of the utility is not printed, but I think this is at // the current setup, the name of the utility is not printed, but I think this is at
// least somewhat better from a user's perspective. // least somewhat better from a user's perspective.
@ -333,7 +331,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app_common() -> App<'static, 'static> { pub fn uu_app_common<'a>() -> App<'a> {
#[cfg(windows)] #[cfg(windows)]
const BINARY_HELP: &str = "read in binary mode (default)"; const BINARY_HELP: &str = "read in binary mode (default)";
#[cfg(not(windows))] #[cfg(not(windows))]
@ -346,55 +344,55 @@ pub fn uu_app_common() -> App<'static, 'static> {
.version(crate_version!()) .version(crate_version!())
.about("Compute and check message digests.") .about("Compute and check message digests.")
.arg( .arg(
Arg::with_name("binary") Arg::new("binary")
.short("b") .short('b')
.long("binary") .long("binary")
.help(BINARY_HELP), .help(BINARY_HELP),
) )
.arg( .arg(
Arg::with_name("check") Arg::new("check")
.short("c") .short('c')
.long("check") .long("check")
.help("read hashsums from the FILEs and check them"), .help("read hashsums from the FILEs and check them"),
) )
.arg( .arg(
Arg::with_name("tag") Arg::new("tag")
.long("tag") .long("tag")
.help("create a BSD-style checksum"), .help("create a BSD-style checksum"),
) )
.arg( .arg(
Arg::with_name("text") Arg::new("text")
.short("t") .short('t')
.long("text") .long("text")
.help(TEXT_HELP) .help(TEXT_HELP)
.conflicts_with("binary"), .conflicts_with("binary"),
) )
.arg( .arg(
Arg::with_name("quiet") Arg::new("quiet")
.short("q") .short('q')
.long("quiet") .long("quiet")
.help("don't print OK for each successfully verified file"), .help("don't print OK for each successfully verified file"),
) )
.arg( .arg(
Arg::with_name("status") Arg::new("status")
.short("s") .short('s')
.long("status") .long("status")
.help("don't output anything, status code shows success"), .help("don't output anything, status code shows success"),
) )
.arg( .arg(
Arg::with_name("strict") Arg::new("strict")
.long("strict") .long("strict")
.help("exit non-zero for improperly formatted checksum lines"), .help("exit non-zero for improperly formatted checksum lines"),
) )
.arg( .arg(
Arg::with_name("warn") Arg::new("warn")
.short("w") .short('w')
.long("warn") .long("warn")
.help("warn about improperly formatted checksum lines"), .help("warn about improperly formatted checksum lines"),
) )
// Needed for variable-length output sums (e.g. SHAKE) // Needed for variable-length output sums (e.g. SHAKE)
.arg( .arg(
Arg::with_name("bits") Arg::new("bits")
.long("bits") .long("bits")
.help("set the size of the output (only for SHAKE)") .help("set the size of the output (only for SHAKE)")
.takes_value(true) .takes_value(true)
@ -403,14 +401,15 @@ pub fn uu_app_common() -> App<'static, 'static> {
.validator(is_valid_bit_num), .validator(is_valid_bit_num),
) )
.arg( .arg(
Arg::with_name("FILE") Arg::new("FILE")
.index(1) .index(1)
.multiple(true) .multiple_occurrences(true)
.value_name("FILE"), .value_name("FILE")
.allow_invalid_utf8(true),
) )
} }
pub fn uu_app_custom() -> App<'static, 'static> { pub fn uu_app_custom<'a>() -> App<'a> {
let mut app = uu_app_common(); let mut app = uu_app_common();
let algorithms = &[ let algorithms = &[
("md5", "work with MD5"), ("md5", "work with MD5"),
@ -436,14 +435,14 @@ pub fn uu_app_custom() -> App<'static, 'static> {
]; ];
for (name, desc) in algorithms { for (name, desc) in algorithms {
app = app.arg(Arg::with_name(name).long(name).help(desc)); app = app.arg(Arg::new(*name).long(name).help(*desc));
} }
app app
} }
// hashsum is handled differently in build.rs, therefore this is not the same // hashsum is handled differently in build.rs, therefore this is not the same
// as in other utilities. // as in other utilities.
fn uu_app(binary_name: &str) -> App<'static, 'static> { fn uu_app<'a>(binary_name: &str) -> App<'a> {
if !is_custom_binary(binary_name) { if !is_custom_binary(binary_name) {
uu_app_custom() uu_app_custom()
} else { } else {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/head.rs" path = "src/head.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
memchr = "2" memchr = "2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["ringbuffer"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["ringbuffer"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -42,14 +42,14 @@ use lines::zlines;
use take::take_all_but; use take::take_all_but;
use take::take_lines; use take::take_lines;
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.usage(USAGE) .override_usage(USAGE)
.arg( .arg(
Arg::with_name(options::BYTES_NAME) Arg::new(options::BYTES_NAME)
.short("c") .short('c')
.long("bytes") .long("bytes")
.value_name("[-]NUM") .value_name("[-]NUM")
.takes_value(true) .takes_value(true)
@ -64,8 +64,8 @@ pub fn uu_app() -> App<'static, 'static> {
.allow_hyphen_values(true), .allow_hyphen_values(true),
) )
.arg( .arg(
Arg::with_name(options::LINES_NAME) Arg::new(options::LINES_NAME)
.short("n") .short('n')
.long("lines") .long("lines")
.value_name("[-]NUM") .value_name("[-]NUM")
.takes_value(true) .takes_value(true)
@ -80,28 +80,28 @@ pub fn uu_app() -> App<'static, 'static> {
.allow_hyphen_values(true), .allow_hyphen_values(true),
) )
.arg( .arg(
Arg::with_name(options::QUIET_NAME) Arg::new(options::QUIET_NAME)
.short("q") .short('q')
.long("quiet") .long("quiet")
.visible_alias("silent") .visible_alias("silent")
.help("never print headers giving file names") .help("never print headers giving file names")
.overrides_with_all(&[options::VERBOSE_NAME, options::QUIET_NAME]), .overrides_with_all(&[options::VERBOSE_NAME, options::QUIET_NAME]),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE_NAME) Arg::new(options::VERBOSE_NAME)
.short("v") .short('v')
.long("verbose") .long("verbose")
.help("always print headers giving file names") .help("always print headers giving file names")
.overrides_with_all(&[options::QUIET_NAME, options::VERBOSE_NAME]), .overrides_with_all(&[options::QUIET_NAME, options::VERBOSE_NAME]),
) )
.arg( .arg(
Arg::with_name(options::ZERO_NAME) Arg::new(options::ZERO_NAME)
.short("z") .short('z')
.long("zero-terminated") .long("zero-terminated")
.help("line delimiter is NUL, not newline") .help("line delimiter is NUL, not newline")
.overrides_with(options::ZERO_NAME), .overrides_with(options::ZERO_NAME),
) )
.arg(Arg::with_name(options::FILES_NAME).multiple(true)) .arg(Arg::new(options::FILES_NAME).multiple_occurrences(true))
} }
#[derive(PartialEq, Debug, Clone, Copy)] #[derive(PartialEq, Debug, Clone, Copy)]
enum Modes { enum Modes {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/hostid.rs" path = "src/hostid.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -25,10 +25,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.usage(SYNTAX) .override_usage(SYNTAX)
} }
fn hostid() { fn hostid() {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/hostname.rs" path = "src/hostname.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
hostname = { version = "0.3", features = ["set"] } hostname = { version = "0.3", features = ["set"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["wide"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["wide"] }

View file

@ -61,7 +61,7 @@ fn usage() -> String {
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
#[cfg(windows)] #[cfg(windows)]
let _handle = wsa::start().map_err_context(|| "failed to start Winsock".to_owned())?; let _handle = wsa::start().map_err_context(|| "failed to start Winsock".to_owned())?;
@ -72,39 +72,39 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(OPT_DOMAIN) Arg::new(OPT_DOMAIN)
.short("d") .short('d')
.long("domain") .long("domain")
.overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT]) .overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the name of the DNS domain if possible"), .help("Display the name of the DNS domain if possible"),
) )
.arg( .arg(
Arg::with_name(OPT_IP_ADDRESS) Arg::new(OPT_IP_ADDRESS)
.short("i") .short('i')
.long("ip-address") .long("ip-address")
.overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT]) .overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the network address(es) of the host"), .help("Display the network address(es) of the host"),
) )
.arg( .arg(
Arg::with_name(OPT_FQDN) Arg::new(OPT_FQDN)
.short("f") .short('f')
.long("fqdn") .long("fqdn")
.overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT]) .overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the FQDN (Fully Qualified Domain Name) (default)"), .help("Display the FQDN (Fully Qualified Domain Name) (default)"),
) )
.arg( .arg(
Arg::with_name(OPT_SHORT) Arg::new(OPT_SHORT)
.short("s") .short('s')
.long("short") .long("short")
.overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT]) .overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
.help("Display the short hostname (the portion before the first dot) if possible"), .help("Display the short hostname (the portion before the first dot) if possible"),
) )
.arg(Arg::with_name(OPT_HOST)) .arg(Arg::new(OPT_HOST).allow_invalid_utf8(true))
} }
fn display_hostname(matches: &ArgMatches) -> UResult<()> { fn display_hostname(matches: &ArgMatches) -> UResult<()> {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/id.rs" path = "src/id.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "process"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "process"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
selinux = { version="0.2.1", optional = true } selinux = { version="0.2.1", optional = true }

View file

@ -132,7 +132,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let after_help = get_description(); let after_help = get_description();
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&after_help[..]) .after_help(&after_help[..])
.get_matches_from(args); .get_matches_from(args);
@ -347,13 +347,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::OPT_AUDIT) Arg::new(options::OPT_AUDIT)
.short("A") .short('A')
.conflicts_with_all(&[ .conflicts_with_all(&[
options::OPT_GROUP, options::OPT_GROUP,
options::OPT_EFFECTIVE_USER, options::OPT_EFFECTIVE_USER,
@ -368,22 +368,22 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::OPT_EFFECTIVE_USER) Arg::new(options::OPT_EFFECTIVE_USER)
.short("u") .short('u')
.long(options::OPT_EFFECTIVE_USER) .long(options::OPT_EFFECTIVE_USER)
.conflicts_with(options::OPT_GROUP) .conflicts_with(options::OPT_GROUP)
.help("Display only the effective user ID as a number."), .help("Display only the effective user ID as a number."),
) )
.arg( .arg(
Arg::with_name(options::OPT_GROUP) Arg::new(options::OPT_GROUP)
.short("g") .short('g')
.long(options::OPT_GROUP) .long(options::OPT_GROUP)
.conflicts_with(options::OPT_EFFECTIVE_USER) .conflicts_with(options::OPT_EFFECTIVE_USER)
.help("Display only the effective group ID as a number"), .help("Display only the effective group ID as a number"),
) )
.arg( .arg(
Arg::with_name(options::OPT_GROUPS) Arg::new(options::OPT_GROUPS)
.short("G") .short('G')
.long(options::OPT_GROUPS) .long(options::OPT_GROUPS)
.conflicts_with_all(&[ .conflicts_with_all(&[
options::OPT_GROUP, options::OPT_GROUP,
@ -399,13 +399,13 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::OPT_HUMAN_READABLE) Arg::new(options::OPT_HUMAN_READABLE)
.short("p") .short('p')
.help("Make the output human-readable. Each display is on a separate line."), .help("Make the output human-readable. Each display is on a separate line."),
) )
.arg( .arg(
Arg::with_name(options::OPT_NAME) Arg::new(options::OPT_NAME)
.short("n") .short('n')
.long(options::OPT_NAME) .long(options::OPT_NAME)
.help( .help(
"Display the name of the user or group ID for the -G, -g and -u options \ "Display the name of the user or group ID for the -G, -g and -u options \
@ -414,13 +414,13 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::OPT_PASSWORD) Arg::new(options::OPT_PASSWORD)
.short("P") .short('P')
.help("Display the id as a password file entry."), .help("Display the id as a password file entry."),
) )
.arg( .arg(
Arg::with_name(options::OPT_REAL_ID) Arg::new(options::OPT_REAL_ID)
.short("r") .short('r')
.long(options::OPT_REAL_ID) .long(options::OPT_REAL_ID)
.help( .help(
"Display the real ID for the -G, -g and -u options instead of \ "Display the real ID for the -G, -g and -u options instead of \
@ -428,8 +428,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::OPT_ZERO) Arg::new(options::OPT_ZERO)
.short("z") .short('z')
.long(options::OPT_ZERO) .long(options::OPT_ZERO)
.help( .help(
"delimit entries with NUL characters, not whitespace;\n\ "delimit entries with NUL characters, not whitespace;\n\
@ -437,15 +437,15 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(options::OPT_CONTEXT) Arg::new(options::OPT_CONTEXT)
.short("Z") .short('Z')
.long(options::OPT_CONTEXT) .long(options::OPT_CONTEXT)
.conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER]) .conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER])
.help(CONTEXT_HELP_TEXT), .help(CONTEXT_HELP_TEXT),
) )
.arg( .arg(
Arg::with_name(options::ARG_USERS) Arg::new(options::ARG_USERS)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.value_name(options::ARG_USERS), .value_name(options::ARG_USERS),
) )

View file

@ -18,7 +18,7 @@ edition = "2018"
path = "src/install.rs" path = "src/install.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
filetime = "0.2" filetime = "0.2"
file_diff = "1.0.0" file_diff = "1.0.0"
libc = ">= 0.2" libc = ">= 0.2"

View file

@ -175,7 +175,7 @@ fn usage() -> String {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 paths: Vec<String> = matches let paths: Vec<String> = matches
.values_of(ARG_FILES) .values_of(ARG_FILES)
@ -192,7 +192,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
@ -203,67 +203,67 @@ pub fn uu_app() -> App<'static, 'static> {
backup_control::arguments::backup_no_args() backup_control::arguments::backup_no_args()
) )
.arg( .arg(
Arg::with_name(OPT_IGNORED) Arg::new(OPT_IGNORED)
.short("c") .short('c')
.help("ignored") .help("ignored")
) )
.arg( .arg(
Arg::with_name(OPT_COMPARE) Arg::new(OPT_COMPARE)
.short("C") .short('C')
.long(OPT_COMPARE) .long(OPT_COMPARE)
.help("compare each pair of source and destination files, and in some cases, do not modify the destination at all") .help("compare each pair of source and destination files, and in some cases, do not modify the destination at all")
) )
.arg( .arg(
Arg::with_name(OPT_DIRECTORY) Arg::new(OPT_DIRECTORY)
.short("d") .short('d')
.long(OPT_DIRECTORY) .long(OPT_DIRECTORY)
.help("treat all arguments as directory names. create all components of the specified directories") .help("treat all arguments as directory names. create all components of the specified directories")
) )
.arg( .arg(
// TODO implement flag // TODO implement flag
Arg::with_name(OPT_CREATE_LEADING) Arg::new(OPT_CREATE_LEADING)
.short("D") .short('D')
.help("create all leading components of DEST except the last, then copy SOURCE to DEST") .help("create all leading components of DEST except the last, then copy SOURCE to DEST")
) )
.arg( .arg(
Arg::with_name(OPT_GROUP) Arg::new(OPT_GROUP)
.short("g") .short('g')
.long(OPT_GROUP) .long(OPT_GROUP)
.help("set group ownership, instead of process's current group") .help("set group ownership, instead of process's current group")
.value_name("GROUP") .value_name("GROUP")
.takes_value(true) .takes_value(true)
) )
.arg( .arg(
Arg::with_name(OPT_MODE) Arg::new(OPT_MODE)
.short("m") .short('m')
.long(OPT_MODE) .long(OPT_MODE)
.help("set permission mode (as in chmod), instead of rwxr-xr-x") .help("set permission mode (as in chmod), instead of rwxr-xr-x")
.value_name("MODE") .value_name("MODE")
.takes_value(true) .takes_value(true)
) )
.arg( .arg(
Arg::with_name(OPT_OWNER) Arg::new(OPT_OWNER)
.short("o") .short('o')
.long(OPT_OWNER) .long(OPT_OWNER)
.help("set ownership (super-user only)") .help("set ownership (super-user only)")
.value_name("OWNER") .value_name("OWNER")
.takes_value(true) .takes_value(true)
) )
.arg( .arg(
Arg::with_name(OPT_PRESERVE_TIMESTAMPS) Arg::new(OPT_PRESERVE_TIMESTAMPS)
.short("p") .short('p')
.long(OPT_PRESERVE_TIMESTAMPS) .long(OPT_PRESERVE_TIMESTAMPS)
.help("apply access/modification times of SOURCE files to corresponding destination files") .help("apply access/modification times of SOURCE files to corresponding destination files")
) )
.arg( .arg(
Arg::with_name(OPT_STRIP) Arg::new(OPT_STRIP)
.short("s") .short('s')
.long(OPT_STRIP) .long(OPT_STRIP)
.help("strip symbol tables (no action Windows)") .help("strip symbol tables (no action Windows)")
) )
.arg( .arg(
Arg::with_name(OPT_STRIP_PROGRAM) Arg::new(OPT_STRIP_PROGRAM)
.long(OPT_STRIP_PROGRAM) .long(OPT_STRIP_PROGRAM)
.help("program used to strip binaries (no action Windows)") .help("program used to strip binaries (no action Windows)")
.value_name("PROGRAM") .value_name("PROGRAM")
@ -273,42 +273,42 @@ pub fn uu_app() -> App<'static, 'static> {
) )
.arg( .arg(
// TODO implement flag // TODO implement flag
Arg::with_name(OPT_TARGET_DIRECTORY) Arg::new(OPT_TARGET_DIRECTORY)
.short("t") .short('t')
.long(OPT_TARGET_DIRECTORY) .long(OPT_TARGET_DIRECTORY)
.help("move all SOURCE arguments into DIRECTORY") .help("move all SOURCE arguments into DIRECTORY")
.value_name("DIRECTORY") .value_name("DIRECTORY")
) )
.arg( .arg(
// TODO implement flag // TODO implement flag
Arg::with_name(OPT_NO_TARGET_DIRECTORY) Arg::new(OPT_NO_TARGET_DIRECTORY)
.short("T") .short('T')
.long(OPT_NO_TARGET_DIRECTORY) .long(OPT_NO_TARGET_DIRECTORY)
.help("(unimplemented) treat DEST as a normal file") .help("(unimplemented) treat DEST as a normal file")
) )
.arg( .arg(
Arg::with_name(OPT_VERBOSE) Arg::new(OPT_VERBOSE)
.short("v") .short('v')
.long(OPT_VERBOSE) .long(OPT_VERBOSE)
.help("explain what is being done") .help("explain what is being done")
) )
.arg( .arg(
// TODO implement flag // TODO implement flag
Arg::with_name(OPT_PRESERVE_CONTEXT) Arg::new(OPT_PRESERVE_CONTEXT)
.short("P") .short('P')
.long(OPT_PRESERVE_CONTEXT) .long(OPT_PRESERVE_CONTEXT)
.help("(unimplemented) preserve security context") .help("(unimplemented) preserve security context")
) )
.arg( .arg(
// TODO implement flag // TODO implement flag
Arg::with_name(OPT_CONTEXT) Arg::new(OPT_CONTEXT)
.short("Z") .short('Z')
.long(OPT_CONTEXT) .long(OPT_CONTEXT)
.help("(unimplemented) set security context of files and directories") .help("(unimplemented) set security context of files and directories")
.value_name("CONTEXT") .value_name("CONTEXT")
) )
.arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true).min_values(1)) .arg(Arg::new(ARG_FILES).multiple_occurrences(true).takes_value(true).min_values(1))
} }
/// Check for unimplemented command line arguments. /// Check for unimplemented command line arguments.

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/join.rs" path = "src/join.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -578,7 +578,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(NAME) App::new(NAME)
.version(crate_version!()) .version(crate_version!())
.about( .about(
@ -587,12 +587,10 @@ standard output. The default join field is the first, delimited by blanks.
When FILE1 or FILE2 (not both) is -, read standard input.", When FILE1 or FILE2 (not both) is -, read standard input.",
) )
.help_message("display this help and exit")
.version_message("display version and exit")
.arg( .arg(
Arg::with_name("a") Arg::new("a")
.short("a") .short('a')
.multiple(true) .multiple_occurrences(true)
.number_of_values(1) .number_of_values(1)
.possible_values(&["1", "2"]) .possible_values(&["1", "2"])
.value_name("FILENUM") .value_name("FILENUM")
@ -602,92 +600,92 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
), ),
) )
.arg( .arg(
Arg::with_name("v") Arg::new("v")
.short("v") .short('v')
.multiple(true) .multiple_occurrences(true)
.number_of_values(1) .number_of_values(1)
.possible_values(&["1", "2"]) .possible_values(&["1", "2"])
.value_name("FILENUM") .value_name("FILENUM")
.help("like -a FILENUM, but suppress joined output lines"), .help("like -a FILENUM, but suppress joined output lines"),
) )
.arg( .arg(
Arg::with_name("e") Arg::new("e")
.short("e") .short('e')
.takes_value(true) .takes_value(true)
.value_name("EMPTY") .value_name("EMPTY")
.help("replace missing input fields with EMPTY"), .help("replace missing input fields with EMPTY"),
) )
.arg( .arg(
Arg::with_name("i") Arg::new("i")
.short("i") .short('i')
.long("ignore-case") .long("ignore-case")
.help("ignore differences in case when comparing fields"), .help("ignore differences in case when comparing fields"),
) )
.arg( .arg(
Arg::with_name("j") Arg::new("j")
.short("j") .short('j')
.takes_value(true) .takes_value(true)
.value_name("FIELD") .value_name("FIELD")
.help("equivalent to '-1 FIELD -2 FIELD'"), .help("equivalent to '-1 FIELD -2 FIELD'"),
) )
.arg( .arg(
Arg::with_name("o") Arg::new("o")
.short("o") .short('o')
.takes_value(true) .takes_value(true)
.value_name("FORMAT") .value_name("FORMAT")
.help("obey FORMAT while constructing output line"), .help("obey FORMAT while constructing output line"),
) )
.arg( .arg(
Arg::with_name("t") Arg::new("t")
.short("t") .short('t')
.takes_value(true) .takes_value(true)
.value_name("CHAR") .value_name("CHAR")
.help("use CHAR as input and output field separator"), .help("use CHAR as input and output field separator"),
) )
.arg( .arg(
Arg::with_name("1") Arg::new("1")
.short("1") .short('1')
.takes_value(true) .takes_value(true)
.value_name("FIELD") .value_name("FIELD")
.help("join on this FIELD of file 1"), .help("join on this FIELD of file 1"),
) )
.arg( .arg(
Arg::with_name("2") Arg::new("2")
.short("2") .short('2')
.takes_value(true) .takes_value(true)
.value_name("FIELD") .value_name("FIELD")
.help("join on this FIELD of file 2"), .help("join on this FIELD of file 2"),
) )
.arg(Arg::with_name("check-order").long("check-order").help( .arg(Arg::new("check-order").long("check-order").help(
"check that the input is correctly sorted, \ "check that the input is correctly sorted, \
even if all input lines are pairable", even if all input lines are pairable",
)) ))
.arg( .arg(
Arg::with_name("nocheck-order") Arg::new("nocheck-order")
.long("nocheck-order") .long("nocheck-order")
.help("do not check that the input is correctly sorted"), .help("do not check that the input is correctly sorted"),
) )
.arg(Arg::with_name("header").long("header").help( .arg(Arg::new("header").long("header").help(
"treat the first line in each file as field headers, \ "treat the first line in each file as field headers, \
print them without trying to pair them", print them without trying to pair them",
)) ))
.arg( .arg(
Arg::with_name("z") Arg::new("z")
.short("z") .short('z')
.long("zero-terminated") .long("zero-terminated")
.help("line delimiter is NUL, not newline"), .help("line delimiter is NUL, not newline"),
) )
.arg( .arg(
Arg::with_name("file1") Arg::new("file1")
.required(true) .required(true)
.value_name("FILE1") .value_name("FILE1")
.hidden(true), .hide(true),
) )
.arg( .arg(
Arg::with_name("file2") Arg::new("file2")
.required(true) .required(true)
.value_name("FILE2") .value_name("FILE2")
.hidden(true), .hide(true),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/kill.rs" path = "src/kill.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["signals"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["signals"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -43,7 +43,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let obs_signal = handle_obsolete(&mut args); let obs_signal = handle_obsolete(&mut args);
let usage = format!("{} [OPTIONS]... PID...", uucore::execution_phrase()); let usage = format!("{} [OPTIONS]... PID...", uucore::execution_phrase());
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
let mode = if matches.is_present(options::TABLE) || matches.is_present(options::TABLE_OLD) { let mode = if matches.is_present(options::TABLE) || matches.is_present(options::TABLE_OLD) {
Mode::Table Mode::Table
@ -78,36 +78,36 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::LIST) Arg::new(options::LIST)
.short("l") .short('l')
.long(options::LIST) .long(options::LIST)
.help("Lists signals") .help("Lists signals")
.conflicts_with(options::TABLE) .conflicts_with(options::TABLE)
.conflicts_with(options::TABLE_OLD), .conflicts_with(options::TABLE_OLD),
) )
.arg( .arg(
Arg::with_name(options::TABLE) Arg::new(options::TABLE)
.short("t") .short('t')
.long(options::TABLE) .long(options::TABLE)
.help("Lists table of signals"), .help("Lists table of signals"),
) )
.arg(Arg::with_name(options::TABLE_OLD).short("L").hidden(true)) .arg(Arg::new(options::TABLE_OLD).short('L').hide(true))
.arg( .arg(
Arg::with_name(options::SIGNAL) Arg::new(options::SIGNAL)
.short("s") .short('s')
.long(options::SIGNAL) .long(options::SIGNAL)
.help("Sends given signal") .help("Sends given signal")
.takes_value(true), .takes_value(true),
) )
.arg( .arg(
Arg::with_name(options::PIDS_OR_SIGNALS) Arg::new(options::PIDS_OR_SIGNALS)
.hidden(true) .hide(true)
.multiple(true), .multiple_occurrences(true),
) )
} }

View file

@ -16,9 +16,9 @@ path = "src/link.rs"
[dependencies] [dependencies]
libc = "0.2.42" libc = "0.2.42"
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
clap = { version = "2.33", features = ["wrap_help"] }
[[bin]] [[bin]]
name = "link" name = "link"

View file

@ -23,7 +23,7 @@ fn usage() -> String {
#[uucore_procs::gen_uumain] #[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); 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 files: Vec<_> = matches let files: Vec<_> = matches
.values_of_os(options::FILES) .values_of_os(options::FILES)
@ -36,16 +36,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.map_err_context(|| format!("cannot create link {} to {}", new.quote(), old.quote())) .map_err_context(|| format!("cannot create link {} to {}", new.quote(), old.quote()))
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::FILES) Arg::new(options::FILES)
.hidden(true) .hide(true)
.required(true) .required(true)
.min_values(2) .min_values(2)
.max_values(2) .max_values(2)
.takes_value(true), .takes_value(true)
.allow_invalid_utf8(true),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/ln.rs" path = "src/ln.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -135,7 +135,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let long_usage = long_usage(); let long_usage = long_usage();
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&*format!( .after_help(&*format!(
"{}\n{}", "{}\n{}",
long_usage, long_usage,
@ -179,30 +179,30 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
exec(&paths[..], &settings) exec(&paths[..], &settings)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg(backup_control::arguments::backup()) .arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args()) .arg(backup_control::arguments::backup_no_args())
// TODO: opts.arg( // TODO: opts.arg(
// Arg::with_name(("d", "directory", "allow users with appropriate privileges to attempt \ // Arg::new(("d", "directory", "allow users with appropriate privileges to attempt \
// to make hard links to directories"); // to make hard links to directories");
.arg( .arg(
Arg::with_name(options::FORCE) Arg::new(options::FORCE)
.short("f") .short('f')
.long(options::FORCE) .long(options::FORCE)
.help("remove existing destination files"), .help("remove existing destination files"),
) )
.arg( .arg(
Arg::with_name(options::INTERACTIVE) Arg::new(options::INTERACTIVE)
.short("i") .short('i')
.long(options::INTERACTIVE) .long(options::INTERACTIVE)
.help("prompt whether to remove existing destination files"), .help("prompt whether to remove existing destination files"),
) )
.arg( .arg(
Arg::with_name(options::NO_DEREFERENCE) Arg::new(options::NO_DEREFERENCE)
.short("n") .short('n')
.long(options::NO_DEREFERENCE) .long(options::NO_DEREFERENCE)
.help( .help(
"treat LINK_NAME as a normal file if it is a \ "treat LINK_NAME as a normal file if it is a \
@ -210,13 +210,13 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
// TODO: opts.arg( // TODO: opts.arg(
// Arg::with_name(("L", "logical", "dereference TARGETs that are symbolic links"); // Arg::new(("L", "logical", "dereference TARGETs that are symbolic links");
// //
// TODO: opts.arg( // TODO: opts.arg(
// Arg::with_name(("P", "physical", "make hard links directly to symbolic links"); // Arg::new(("P", "physical", "make hard links directly to symbolic links");
.arg( .arg(
Arg::with_name(options::SYMBOLIC) Arg::new(options::SYMBOLIC)
.short("s") .short('s')
.long("symbolic") .long("symbolic")
.help("make symbolic links instead of hard links") .help("make symbolic links instead of hard links")
// override added for https://github.com/uutils/coreutils/issues/2359 // override added for https://github.com/uutils/coreutils/issues/2359
@ -224,35 +224,35 @@ pub fn uu_app() -> App<'static, 'static> {
) )
.arg(backup_control::arguments::suffix()) .arg(backup_control::arguments::suffix())
.arg( .arg(
Arg::with_name(options::TARGET_DIRECTORY) Arg::new(options::TARGET_DIRECTORY)
.short("t") .short('t')
.long(options::TARGET_DIRECTORY) .long(options::TARGET_DIRECTORY)
.help("specify the DIRECTORY in which to create the links") .help("specify the DIRECTORY in which to create the links")
.value_name("DIRECTORY") .value_name("DIRECTORY")
.conflicts_with(options::NO_TARGET_DIRECTORY), .conflicts_with(options::NO_TARGET_DIRECTORY),
) )
.arg( .arg(
Arg::with_name(options::NO_TARGET_DIRECTORY) Arg::new(options::NO_TARGET_DIRECTORY)
.short("T") .short('T')
.long(options::NO_TARGET_DIRECTORY) .long(options::NO_TARGET_DIRECTORY)
.help("treat LINK_NAME as a normal file always"), .help("treat LINK_NAME as a normal file always"),
) )
.arg( .arg(
Arg::with_name(options::RELATIVE) Arg::new(options::RELATIVE)
.short("r") .short('r')
.long(options::RELATIVE) .long(options::RELATIVE)
.help("create symbolic links relative to link location") .help("create symbolic links relative to link location")
.requires(options::SYMBOLIC), .requires(options::SYMBOLIC),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE) Arg::new(options::VERBOSE)
.short("v") .short('v')
.long(options::VERBOSE) .long(options::VERBOSE)
.help("print name of each linked file"), .help("print name of each linked file"),
) )
.arg( .arg(
Arg::with_name(ARG_FILES) Arg::new(ARG_FILES)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.min_values(1), .min_values(1),

View file

@ -16,7 +16,7 @@ path = "src/logname.rs"
[dependencies] [dependencies]
libc = "0.2.42" libc = "0.2.42"
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -45,7 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.collect_str(InvalidEncodingHandling::Ignore) .collect_str(InvalidEncodingHandling::Ignore)
.accept_any(); .accept_any();
let _ = uu_app().usage(usage()).get_matches_from(args); let _ = uu_app().override_usage(usage()).get_matches_from(args);
match get_userlogin() { match get_userlogin() {
Some(userlogin) => println!("{}", userlogin), Some(userlogin) => println!("{}", userlogin),
@ -55,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)

View file

@ -16,7 +16,7 @@ path = "src/ls.rs"
[dependencies] [dependencies]
chrono = "0.4.19" chrono = "0.4.19"
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo", "env"] }
unicode-width = "0.1.8" unicode-width = "0.1.8"
number_prefix = "0.4" number_prefix = "0.4"
term_grid = "0.1.5" term_grid = "0.1.5"

View file

@ -687,7 +687,7 @@ impl Config {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); let usage = usage();
let app = uu_app().usage(&usage[..]); let app = uu_app().override_usage(&usage[..]);
let matches = app.get_matches_from(args); let matches = app.get_matches_from(args);
@ -701,7 +701,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
list(locs, config) list(locs, config)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about( .about(
@ -711,7 +711,7 @@ pub fn uu_app() -> App<'static, 'static> {
) )
// Format arguments // Format arguments
.arg( .arg(
Arg::with_name(options::FORMAT) Arg::new(options::FORMAT)
.long(options::FORMAT) .long(options::FORMAT)
.help("Set the display format.") .help("Set the display format.")
.takes_value(true) .takes_value(true)
@ -736,8 +736,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::format::COLUMNS) Arg::new(options::format::COLUMNS)
.short(options::format::COLUMNS) .short('C')
.help("Display the files in columns.") .help("Display the files in columns.")
.overrides_with_all(&[ .overrides_with_all(&[
options::FORMAT, options::FORMAT,
@ -748,8 +748,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::format::LONG) Arg::new(options::format::LONG)
.short("l") .short('l')
.long(options::format::LONG) .long(options::format::LONG)
.help("Display detailed information.") .help("Display detailed information.")
.overrides_with_all(&[ .overrides_with_all(&[
@ -761,8 +761,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::format::ACROSS) Arg::new(options::format::ACROSS)
.short(options::format::ACROSS) .short('x')
.help("List entries in rows instead of in columns.") .help("List entries in rows instead of in columns.")
.overrides_with_all(&[ .overrides_with_all(&[
options::FORMAT, options::FORMAT,
@ -773,8 +773,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::format::COMMAS) Arg::new(options::format::COMMAS)
.short(options::format::COMMAS) .short('m')
.help("List entries separated by commas.") .help("List entries separated by commas.")
.overrides_with_all(&[ .overrides_with_all(&[
options::FORMAT, options::FORMAT,
@ -791,36 +791,36 @@ pub fn uu_app() -> App<'static, 'static> {
// ls -1g1 // ls -1g1
// even though `ls -11` and `ls -1 -g -1` work. // even though `ls -11` and `ls -1 -g -1` work.
.arg( .arg(
Arg::with_name(options::format::ONE_LINE) Arg::new(options::format::ONE_LINE)
.short(options::format::ONE_LINE) .short('1')
.help("List one file per line.") .help("List one file per line.")
.multiple(true), .multiple_occurrences(true),
) )
.arg( .arg(
Arg::with_name(options::format::LONG_NO_GROUP) Arg::new(options::format::LONG_NO_GROUP)
.short(options::format::LONG_NO_GROUP) .short('o')
.help( .help(
"Long format without group information. \ "Long format without group information. \
Identical to --format=long with --no-group.", Identical to --format=long with --no-group.",
) )
.multiple(true), .multiple_occurrences(true),
) )
.arg( .arg(
Arg::with_name(options::format::LONG_NO_OWNER) Arg::new(options::format::LONG_NO_OWNER)
.short(options::format::LONG_NO_OWNER) .short('g')
.help("Long format without owner information.") .help("Long format without owner information.")
.multiple(true), .multiple_occurrences(true),
) )
.arg( .arg(
Arg::with_name(options::format::LONG_NUMERIC_UID_GID) Arg::new(options::format::LONG_NUMERIC_UID_GID)
.short("n") .short('n')
.long(options::format::LONG_NUMERIC_UID_GID) .long(options::format::LONG_NUMERIC_UID_GID)
.help("-l with numeric UIDs and GIDs.") .help("-l with numeric UIDs and GIDs.")
.multiple(true), .multiple_occurrences(true),
) )
// Quoting style // Quoting style
.arg( .arg(
Arg::with_name(options::QUOTING_STYLE) Arg::new(options::QUOTING_STYLE)
.long(options::QUOTING_STYLE) .long(options::QUOTING_STYLE)
.takes_value(true) .takes_value(true)
.help("Set quoting style.") .help("Set quoting style.")
@ -841,8 +841,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::quoting::LITERAL) Arg::new(options::quoting::LITERAL)
.short("N") .short('N')
.long(options::quoting::LITERAL) .long(options::quoting::LITERAL)
.help("Use literal quoting style. Equivalent to `--quoting-style=literal`") .help("Use literal quoting style. Equivalent to `--quoting-style=literal`")
.overrides_with_all(&[ .overrides_with_all(&[
@ -853,8 +853,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::quoting::ESCAPE) Arg::new(options::quoting::ESCAPE)
.short("b") .short('b')
.long(options::quoting::ESCAPE) .long(options::quoting::ESCAPE)
.help("Use escape quoting style. Equivalent to `--quoting-style=escape`") .help("Use escape quoting style. Equivalent to `--quoting-style=escape`")
.overrides_with_all(&[ .overrides_with_all(&[
@ -865,8 +865,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::quoting::C) Arg::new(options::quoting::C)
.short("Q") .short('Q')
.long(options::quoting::C) .long(options::quoting::C)
.help("Use C quoting style. Equivalent to `--quoting-style=c`") .help("Use C quoting style. Equivalent to `--quoting-style=c`")
.overrides_with_all(&[ .overrides_with_all(&[
@ -878,21 +878,21 @@ pub fn uu_app() -> App<'static, 'static> {
) )
// Control characters // Control characters
.arg( .arg(
Arg::with_name(options::HIDE_CONTROL_CHARS) Arg::new(options::HIDE_CONTROL_CHARS)
.short("q") .short('q')
.long(options::HIDE_CONTROL_CHARS) .long(options::HIDE_CONTROL_CHARS)
.help("Replace control characters with '?' if they are not escaped.") .help("Replace control characters with '?' if they are not escaped.")
.overrides_with_all(&[options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS]), .overrides_with_all(&[options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS]),
) )
.arg( .arg(
Arg::with_name(options::SHOW_CONTROL_CHARS) Arg::new(options::SHOW_CONTROL_CHARS)
.long(options::SHOW_CONTROL_CHARS) .long(options::SHOW_CONTROL_CHARS)
.help("Show control characters 'as is' if they are not escaped.") .help("Show control characters 'as is' if they are not escaped.")
.overrides_with_all(&[options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS]), .overrides_with_all(&[options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS]),
) )
// Time arguments // Time arguments
.arg( .arg(
Arg::with_name(options::TIME) Arg::new(options::TIME)
.long(options::TIME) .long(options::TIME)
.help( .help(
"Show time in <field>:\n\ "Show time in <field>:\n\
@ -910,8 +910,8 @@ pub fn uu_app() -> App<'static, 'static> {
.overrides_with_all(&[options::TIME, options::time::ACCESS, options::time::CHANGE]), .overrides_with_all(&[options::TIME, options::time::ACCESS, options::time::CHANGE]),
) )
.arg( .arg(
Arg::with_name(options::time::CHANGE) Arg::new(options::time::CHANGE)
.short(options::time::CHANGE) .short('c')
.help( .help(
"If the long listing format (e.g., -l, -o) is being used, print the status \ "If the long listing format (e.g., -l, -o) is being used, print the status \
change time (the 'ctime' in the inode) instead of the modification time. When \ change time (the 'ctime' in the inode) instead of the modification time. When \
@ -921,8 +921,8 @@ pub fn uu_app() -> App<'static, 'static> {
.overrides_with_all(&[options::TIME, options::time::ACCESS, options::time::CHANGE]), .overrides_with_all(&[options::TIME, options::time::ACCESS, options::time::CHANGE]),
) )
.arg( .arg(
Arg::with_name(options::time::ACCESS) Arg::new(options::time::ACCESS)
.short(options::time::ACCESS) .short('u')
.help( .help(
"If the long listing format (e.g., -l, -o) is being used, print the status \ "If the long listing format (e.g., -l, -o) is being used, print the status \
access time instead of the modification time. When explicitly sorting by time \ access time instead of the modification time. When explicitly sorting by time \
@ -933,33 +933,33 @@ pub fn uu_app() -> App<'static, 'static> {
) )
// Hide and ignore // Hide and ignore
.arg( .arg(
Arg::with_name(options::HIDE) Arg::new(options::HIDE)
.long(options::HIDE) .long(options::HIDE)
.takes_value(true) .takes_value(true)
.multiple(true) .multiple_occurrences(true)
.value_name("PATTERN") .value_name("PATTERN")
.help( .help(
"do not list implied entries matching shell PATTERN (overridden by -a or -A)", "do not list implied entries matching shell PATTERN (overridden by -a or -A)",
), ),
) )
.arg( .arg(
Arg::with_name(options::IGNORE) Arg::new(options::IGNORE)
.short("I") .short('I')
.long(options::IGNORE) .long(options::IGNORE)
.takes_value(true) .takes_value(true)
.multiple(true) .multiple_occurrences(true)
.value_name("PATTERN") .value_name("PATTERN")
.help("do not list implied entries matching shell PATTERN"), .help("do not list implied entries matching shell PATTERN"),
) )
.arg( .arg(
Arg::with_name(options::IGNORE_BACKUPS) Arg::new(options::IGNORE_BACKUPS)
.short("B") .short('B')
.long(options::IGNORE_BACKUPS) .long(options::IGNORE_BACKUPS)
.help("Ignore entries which end with ~."), .help("Ignore entries which end with ~."),
) )
// Sort arguments // Sort arguments
.arg( .arg(
Arg::with_name(options::SORT) Arg::new(options::SORT)
.long(options::SORT) .long(options::SORT)
.help("Sort by <field>: name, none (-U), time (-t), size (-S) or extension (-X)") .help("Sort by <field>: name, none (-U), time (-t), size (-S) or extension (-X)")
.value_name("field") .value_name("field")
@ -976,8 +976,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::sort::SIZE) Arg::new(options::sort::SIZE)
.short(options::sort::SIZE) .short('S')
.help("Sort by file size, largest first.") .help("Sort by file size, largest first.")
.overrides_with_all(&[ .overrides_with_all(&[
options::SORT, options::SORT,
@ -989,8 +989,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::sort::TIME) Arg::new(options::sort::TIME)
.short(options::sort::TIME) .short('t')
.help("Sort by modification time (the 'mtime' in the inode), newest first.") .help("Sort by modification time (the 'mtime' in the inode), newest first.")
.overrides_with_all(&[ .overrides_with_all(&[
options::SORT, options::SORT,
@ -1002,8 +1002,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::sort::VERSION) Arg::new(options::sort::VERSION)
.short(options::sort::VERSION) .short('v')
.help("Natural sort of (version) numbers in the filenames.") .help("Natural sort of (version) numbers in the filenames.")
.overrides_with_all(&[ .overrides_with_all(&[
options::SORT, options::SORT,
@ -1015,8 +1015,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::sort::EXTENSION) Arg::new(options::sort::EXTENSION)
.short(options::sort::EXTENSION) .short('X')
.help("Sort alphabetically by entry extension.") .help("Sort alphabetically by entry extension.")
.overrides_with_all(&[ .overrides_with_all(&[
options::SORT, options::SORT,
@ -1028,8 +1028,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::sort::NONE) Arg::new(options::sort::NONE)
.short(options::sort::NONE) .short('U')
.help( .help(
"Do not sort; list the files in whatever order they are stored in the \ "Do not sort; list the files in whatever order they are stored in the \
directory. This is especially useful when listing very large directories, \ directory. This is especially useful when listing very large directories, \
@ -1046,8 +1046,8 @@ pub fn uu_app() -> App<'static, 'static> {
) )
// Dereferencing // Dereferencing
.arg( .arg(
Arg::with_name(options::dereference::ALL) Arg::new(options::dereference::ALL)
.short("L") .short('L')
.long(options::dereference::ALL) .long(options::dereference::ALL)
.help( .help(
"When showing file information for a symbolic link, show information for the \ "When showing file information for a symbolic link, show information for the \
@ -1060,7 +1060,7 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::dereference::DIR_ARGS) Arg::new(options::dereference::DIR_ARGS)
.long(options::dereference::DIR_ARGS) .long(options::dereference::DIR_ARGS)
.help( .help(
"Do not dereference symlinks except when they link to directories and are \ "Do not dereference symlinks except when they link to directories and are \
@ -1073,8 +1073,8 @@ pub fn uu_app() -> App<'static, 'static> {
]), ]),
) )
.arg( .arg(
Arg::with_name(options::dereference::ARGS) Arg::new(options::dereference::ARGS)
.short("H") .short('H')
.long(options::dereference::ARGS) .long(options::dereference::ARGS)
.help("Do not dereference symlinks except when given as command line arguments.") .help("Do not dereference symlinks except when given as command line arguments.")
.overrides_with_all(&[ .overrides_with_all(&[
@ -1085,25 +1085,25 @@ pub fn uu_app() -> App<'static, 'static> {
) )
// Long format options // Long format options
.arg( .arg(
Arg::with_name(options::NO_GROUP) Arg::new(options::NO_GROUP)
.long(options::NO_GROUP) .long(options::NO_GROUP)
.short("-G") .short('G')
.help("Do not show group in long format."), .help("Do not show group in long format."),
) )
.arg(Arg::with_name(options::AUTHOR).long(options::AUTHOR).help( .arg(Arg::new(options::AUTHOR).long(options::AUTHOR).help(
"Show author in long format. \ "Show author in long format. \
On the supported platforms, the author always matches the file owner.", On the supported platforms, the author always matches the file owner.",
)) ))
// Other Flags // Other Flags
.arg( .arg(
Arg::with_name(options::files::ALL) Arg::new(options::files::ALL)
.short("a") .short('a')
.long(options::files::ALL) .long(options::files::ALL)
.help("Do not ignore hidden files (files with names that start with '.')."), .help("Do not ignore hidden files (files with names that start with '.')."),
) )
.arg( .arg(
Arg::with_name(options::files::ALMOST_ALL) Arg::new(options::files::ALMOST_ALL)
.short("A") .short('A')
.long(options::files::ALMOST_ALL) .long(options::files::ALMOST_ALL)
.help( .help(
"In a directory, do not ignore all file names that start with '.', \ "In a directory, do not ignore all file names that start with '.', \
@ -1111,8 +1111,8 @@ only ignore '.' and '..'.",
), ),
) )
.arg( .arg(
Arg::with_name(options::DIRECTORY) Arg::new(options::DIRECTORY)
.short("d") .short('d')
.long(options::DIRECTORY) .long(options::DIRECTORY)
.help( .help(
"Only list the names of directories, rather than listing directory contents. \ "Only list the names of directories, rather than listing directory contents. \
@ -1122,26 +1122,26 @@ only ignore '.' and '..'.",
), ),
) )
.arg( .arg(
Arg::with_name(options::size::HUMAN_READABLE) Arg::new(options::size::HUMAN_READABLE)
.short("h") .short('h')
.long(options::size::HUMAN_READABLE) .long(options::size::HUMAN_READABLE)
.help("Print human readable file sizes (e.g. 1K 234M 56G).") .help("Print human readable file sizes (e.g. 1K 234M 56G).")
.overrides_with(options::size::SI), .overrides_with(options::size::SI),
) )
.arg( .arg(
Arg::with_name(options::size::SI) Arg::new(options::size::SI)
.long(options::size::SI) .long(options::size::SI)
.help("Print human readable file sizes using powers of 1000 instead of 1024."), .help("Print human readable file sizes using powers of 1000 instead of 1024."),
) )
.arg( .arg(
Arg::with_name(options::INODE) Arg::new(options::INODE)
.short("i") .short('i')
.long(options::INODE) .long(options::INODE)
.help("print the index number of each file"), .help("print the index number of each file"),
) )
.arg( .arg(
Arg::with_name(options::REVERSE) Arg::new(options::REVERSE)
.short("r") .short('r')
.long(options::REVERSE) .long(options::REVERSE)
.help( .help(
"Reverse whatever the sorting method is e.g., list files in reverse \ "Reverse whatever the sorting method is e.g., list files in reverse \
@ -1149,21 +1149,21 @@ only ignore '.' and '..'.",
), ),
) )
.arg( .arg(
Arg::with_name(options::RECURSIVE) Arg::new(options::RECURSIVE)
.short("R") .short('R')
.long(options::RECURSIVE) .long(options::RECURSIVE)
.help("List the contents of all directories recursively."), .help("List the contents of all directories recursively."),
) )
.arg( .arg(
Arg::with_name(options::WIDTH) Arg::new(options::WIDTH)
.long(options::WIDTH) .long(options::WIDTH)
.short("w") .short('w')
.help("Assume that the terminal is COLS columns wide.") .help("Assume that the terminal is COLS columns wide.")
.value_name("COLS") .value_name("COLS")
.takes_value(true), .takes_value(true),
) )
.arg( .arg(
Arg::with_name(options::COLOR) Arg::new(options::COLOR)
.long(options::COLOR) .long(options::COLOR)
.help("Color output based on file type.") .help("Color output based on file type.")
.takes_value(true) .takes_value(true)
@ -1174,7 +1174,7 @@ only ignore '.' and '..'.",
.min_values(0), .min_values(0),
) )
.arg( .arg(
Arg::with_name(options::INDICATOR_STYLE) Arg::new(options::INDICATOR_STYLE)
.long(options::INDICATOR_STYLE) .long(options::INDICATOR_STYLE)
.help( .help(
"Append indicator with style WORD to entry names: \ "Append indicator with style WORD to entry names: \
@ -1190,8 +1190,8 @@ only ignore '.' and '..'.",
]), ]),
) )
.arg( .arg(
Arg::with_name(options::indicator_style::CLASSIFY) Arg::new(options::indicator_style::CLASSIFY)
.short("F") .short('F')
.long(options::indicator_style::CLASSIFY) .long(options::indicator_style::CLASSIFY)
.help( .help(
"Append a character to each file name indicating the file type. Also, for \ "Append a character to each file name indicating the file type. Also, for \
@ -1207,7 +1207,7 @@ only ignore '.' and '..'.",
]), ]),
) )
.arg( .arg(
Arg::with_name(options::indicator_style::FILE_TYPE) Arg::new(options::indicator_style::FILE_TYPE)
.long(options::indicator_style::FILE_TYPE) .long(options::indicator_style::FILE_TYPE)
.help("Same as --classify, but do not append '*'") .help("Same as --classify, but do not append '*'")
.overrides_with_all(&[ .overrides_with_all(&[
@ -1218,8 +1218,8 @@ only ignore '.' and '..'.",
]), ]),
) )
.arg( .arg(
Arg::with_name(options::indicator_style::SLASH) Arg::new(options::indicator_style::SLASH)
.short(options::indicator_style::SLASH) .short('p')
.help("Append / indicator to directories.") .help("Append / indicator to directories.")
.overrides_with_all(&[ .overrides_with_all(&[
options::indicator_style::FILE_TYPE, options::indicator_style::FILE_TYPE,
@ -1230,7 +1230,7 @@ only ignore '.' and '..'.",
) )
.arg( .arg(
//This still needs support for posix-*, +FORMAT //This still needs support for posix-*, +FORMAT
Arg::with_name(options::TIME_STYLE) Arg::new(options::TIME_STYLE)
.long(options::TIME_STYLE) .long(options::TIME_STYLE)
.help("time/date format with -l; see TIME_STYLE below") .help("time/date format with -l; see TIME_STYLE below")
.value_name("TIME_STYLE") .value_name("TIME_STYLE")
@ -1239,22 +1239,23 @@ only ignore '.' and '..'.",
.overrides_with_all(&[options::TIME_STYLE]), .overrides_with_all(&[options::TIME_STYLE]),
) )
.arg( .arg(
Arg::with_name(options::FULL_TIME) Arg::new(options::FULL_TIME)
.long(options::FULL_TIME) .long(options::FULL_TIME)
.overrides_with(options::FULL_TIME) .overrides_with(options::FULL_TIME)
.help("like -l --time-style=full-iso"), .help("like -l --time-style=full-iso"),
) )
.arg( .arg(
Arg::with_name(options::CONTEXT) Arg::new(options::CONTEXT)
.short("Z") .short('Z')
.long(options::CONTEXT) .long(options::CONTEXT)
.help(CONTEXT_HELP_TEXT), .help(CONTEXT_HELP_TEXT),
) )
// Positional arguments // Positional arguments
.arg( .arg(
Arg::with_name(options::PATHS) Arg::new(options::PATHS)
.multiple(true) .multiple_occurrences(true)
.takes_value(true), .takes_value(true)
.allow_invalid_utf8(true),
) )
.after_help( .after_help(
"The TIME_STYLE argument can be full-iso, long-iso, iso. \ "The TIME_STYLE argument can be full-iso, long-iso, iso. \

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/mkdir.rs" path = "src/mkdir.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "mode"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -96,7 +96,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// opts.optflag("Z", "context", "set SELinux security context" + // opts.optflag("Z", "context", "set SELinux security context" +
// " of each created directory to CTX"), // " of each created directory to CTX"),
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&after_help[..]) .after_help(&after_help[..])
.get_matches_from(args); .get_matches_from(args);
@ -110,35 +110,36 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::MODE) Arg::new(options::MODE)
.short("m") .short('m')
.long(options::MODE) .long(options::MODE)
.help("set file mode (not implemented on windows)") .help("set file mode (not implemented on windows)")
.default_value("755"), .default_value("755"),
) )
.arg( .arg(
Arg::with_name(options::PARENTS) Arg::new(options::PARENTS)
.short("p") .short('p')
.long(options::PARENTS) .long(options::PARENTS)
.alias("parent") .alias("parent")
.help("make parent directories as needed"), .help("make parent directories as needed"),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE) Arg::new(options::VERBOSE)
.short("v") .short('v')
.long(options::VERBOSE) .long(options::VERBOSE)
.help("print a message for each printed directory"), .help("print a message for each printed directory"),
) )
.arg( .arg(
Arg::with_name(options::DIRS) Arg::new(options::DIRS)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.min_values(1), .min_values(1)
.allow_invalid_utf8(true),
) )
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/mkfifo.rs" path = "src/mkfifo.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -69,27 +69,27 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.usage(USAGE) .override_usage(USAGE)
.about(SUMMARY) .about(SUMMARY)
.arg( .arg(
Arg::with_name(options::MODE) Arg::new(options::MODE)
.short("m") .short('m')
.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("0666"),
) )
.arg( .arg(
Arg::with_name(options::SE_LINUX_SECURITY_CONTEXT) Arg::new(options::SE_LINUX_SECURITY_CONTEXT)
.short(options::SE_LINUX_SECURITY_CONTEXT) .short('Z')
.help("set the SELinux security context to default type"), .help("set the SELinux security context to default type"),
) )
.arg( .arg(
Arg::with_name(options::CONTEXT) Arg::new(options::CONTEXT)
.long(options::CONTEXT) .long(options::CONTEXT)
.value_name("CTX") .value_name("CTX")
.help( .help(
@ -97,5 +97,9 @@ pub fn uu_app() -> App<'static, 'static> {
or SMACK security context to CTX", or SMACK security context to CTX",
), ),
) )
.arg(Arg::with_name(options::FIFO).hidden(true).multiple(true)) .arg(
Arg::new(options::FIFO)
.hide(true)
.multiple_occurrences(true),
)
} }

View file

@ -16,7 +16,7 @@ name = "uu_mknod"
path = "src/mknod.rs" path = "src/mknod.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "^0.2.42" libc = "^0.2.42"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["mode"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }

View file

@ -143,28 +143,28 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.usage(USAGE) .override_usage(USAGE)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name("mode") Arg::new("mode")
.short("m") .short('m')
.long("mode") .long("mode")
.value_name("MODE") .value_name("MODE")
.help("set file permission bits to MODE, not a=rw - umask"), .help("set file permission bits to MODE, not a=rw - umask"),
) )
.arg( .arg(
Arg::with_name("name") Arg::new("name")
.value_name("NAME") .value_name("NAME")
.help("name of the new file") .help("name of the new file")
.required(true) .required(true)
.index(1), .index(1),
) )
.arg( .arg(
Arg::with_name("type") Arg::new("type")
.value_name("TYPE") .value_name("TYPE")
.help("type of the new file (b, c, u or p)") .help("type of the new file (b, c, u or p)")
.required(true) .required(true)
@ -172,14 +172,14 @@ pub fn uu_app() -> App<'static, 'static> {
.index(2), .index(2),
) )
.arg( .arg(
Arg::with_name("major") Arg::new("major")
.value_name("MAJOR") .value_name("MAJOR")
.help("major file type") .help("major file type")
.validator(valid_u64) .validator(valid_u64)
.index(3), .index(3),
) )
.arg( .arg(
Arg::with_name("minor") Arg::new("minor")
.value_name("MINOR") .value_name("MINOR")
.help("minor file type") .help("minor file type")
.validator(valid_u64) .validator(valid_u64)
@ -202,7 +202,7 @@ fn get_mode(matches: &ArgMatches) -> Result<mode_t, String> {
} }
} }
fn valid_type(tpe: String) -> Result<(), String> { fn valid_type(tpe: &str) -> Result<(), String> {
// Only check the first character, to allow mnemonic usage like // Only check the first character, to allow mnemonic usage like
// 'mknod /dev/rst0 character 18 0'. // 'mknod /dev/rst0 character 18 0'.
tpe.chars() tpe.chars()
@ -217,6 +217,6 @@ fn valid_type(tpe: String) -> Result<(), String> {
}) })
} }
fn valid_u64(num: String) -> Result<(), String> { fn valid_u64(num: &str) -> Result<(), String> {
num.parse::<u64>().map(|_| ()).map_err(|_| num) num.parse::<u64>().map(|_| ()).map_err(|_| num.into())
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/mktemp.rs" path = "src/mktemp.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
rand = "0.5" rand = "0.5"
tempfile = "3.1" tempfile = "3.1"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }

Some files were not shown because too many files have changed in this diff Show more