1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

Merge branch 'uutils:main' into stat-fails-to-read-a-file-redirected-to-stdin

This commit is contained in:
Kartik Sharma 2022-03-23 20:09:42 +05:30 committed by GitHub
commit 6b85579498
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
237 changed files with 1632 additions and 992 deletions

View file

@ -638,7 +638,7 @@ jobs:
# target-specific options # target-specific options
# * CARGO_FEATURES_OPTION # * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='' ; CARGO_FEATURES_OPTION='' ;
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
outputs CARGO_FEATURES_OPTION outputs CARGO_FEATURES_OPTION
# * CARGO_USE_CROSS (truthy) # * CARGO_USE_CROSS (truthy)
CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac; CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac;
@ -705,7 +705,7 @@ jobs:
## Dependent VARs setup ## Dependent VARs setup
outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# * determine sub-crate utility list # * determine sub-crate utility list
UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" UTILITY_LIST="$(./util/show-utils.sh ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }})"
echo UTILITY_LIST=${UTILITY_LIST} echo UTILITY_LIST=${UTILITY_LIST}
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS outputs CARGO_UTILITY_LIST_OPTIONS
@ -948,7 +948,7 @@ jobs:
# target-specific options # target-specific options
# * CARGO_FEATURES_OPTION # * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='--all-features' ; ## default to '--all-features' for code coverage CARGO_FEATURES_OPTION='--all-features' ; ## default to '--all-features' for code coverage
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
outputs CARGO_FEATURES_OPTION outputs CARGO_FEATURES_OPTION
# * CODECOV_FLAGS # * CODECOV_FLAGS
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' ) CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
@ -988,7 +988,7 @@ jobs:
## Dependent VARs setup ## Dependent VARs setup
outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# * determine sub-crate utility list # * determine sub-crate utility list
UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" UTILITY_LIST="$(./util/show-utils.sh ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }})"
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS outputs CARGO_UTILITY_LIST_OPTIONS
- name: Test uucore - name: Test uucore

View file

@ -48,6 +48,7 @@ EditorConfig
FreeBSD FreeBSD
Gmail Gmail
GNU GNU
Illumos
Irix Irix
MS-DOS MS-DOS
MSDOS MSDOS

228
Cargo.lock generated
View file

@ -280,9 +280,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.0.10" version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a30c3bf9ff12dfe5dae53f0a96e0febcd18420d1c0e7fad77796d9d5c4b5375" checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
@ -292,7 +292,7 @@ dependencies = [
"strsim 0.10.0", "strsim 0.10.0",
"termcolor", "termcolor",
"terminal_size", "terminal_size",
"textwrap 0.14.2", "textwrap 0.15.0",
] ]
[[package]] [[package]]
@ -301,7 +301,7 @@ version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d044e9db8cd0f68191becdeb5246b7462e4cf0c069b19ae00d1bf3fa9889498d" checksum = "d044e9db8cd0f68191becdeb5246b7462e4cf0c069b19ae00d1bf3fa9889498d"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
] ]
[[package]] [[package]]
@ -331,7 +331,7 @@ version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"chrono", "chrono",
"clap 3.0.10", "clap 3.1.6",
"clap_complete", "clap_complete",
"conv", "conv",
"filetime", "filetime",
@ -349,7 +349,7 @@ dependencies = [
"selinux", "selinux",
"sha1", "sha1",
"tempfile", "tempfile",
"textwrap 0.14.2", "textwrap 0.15.0",
"time", "time",
"unindent", "unindent",
"unix_socket", "unix_socket",
@ -1065,9 +1065,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.113" version = "0.2.121"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9" checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1375,9 +1375,9 @@ dependencies = [
[[package]] [[package]]
name = "ouroboros" name = "ouroboros"
version = "0.14.2" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71643f290d126e18ac2598876d01e1d57aed164afc78fdb6e2a0c6589a1f6662" checksum = "9f31a3b678685b150cba82b702dcdc5e155893f63610cf388d30cd988d4ca2bf"
dependencies = [ dependencies = [
"aliasable", "aliasable",
"ouroboros_macro", "ouroboros_macro",
@ -1386,9 +1386,9 @@ dependencies = [
[[package]] [[package]]
name = "ouroboros_macro" name = "ouroboros_macro"
version = "0.14.2" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed9a247206016d424fe8497bc611e510887af5c261fbbf977877c4bb55ca4d82" checksum = "084fd65d5dd8b3772edccb5ffd1e4b7eba43897ecd0f9401e330e8c542959408"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"proc-macro-error", "proc-macro-error",
@ -2087,9 +2087,9 @@ dependencies = [
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.14.2" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
dependencies = [ dependencies = [
"smawk", "smawk",
"terminal_size", "terminal_size",
@ -2282,7 +2282,7 @@ checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b"
name = "uu_arch" name = "uu_arch"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"platform-info", "platform-info",
"uucore", "uucore",
] ]
@ -2291,7 +2291,7 @@ dependencies = [
name = "uu_base32" name = "uu_base32"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2307,7 +2307,7 @@ dependencies = [
name = "uu_basename" name = "uu_basename"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2315,7 +2315,7 @@ dependencies = [
name = "uu_basenc" name = "uu_basenc"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uu_base32", "uu_base32",
"uucore", "uucore",
] ]
@ -2325,7 +2325,7 @@ name = "uu_cat"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap 3.0.10", "clap 3.1.6",
"nix 0.23.1", "nix 0.23.1",
"thiserror", "thiserror",
"unix_socket", "unix_socket",
@ -2336,7 +2336,7 @@ dependencies = [
name = "uu_chcon" name = "uu_chcon"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"fts-sys", "fts-sys",
"libc", "libc",
"selinux", "selinux",
@ -2348,7 +2348,7 @@ dependencies = [
name = "uu_chgrp" name = "uu_chgrp"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2356,7 +2356,7 @@ dependencies = [
name = "uu_chmod" name = "uu_chmod"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2365,7 +2365,7 @@ dependencies = [
name = "uu_chown" name = "uu_chown"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2373,7 +2373,7 @@ dependencies = [
name = "uu_chroot" name = "uu_chroot"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2381,7 +2381,7 @@ dependencies = [
name = "uu_cksum" name = "uu_cksum"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2389,7 +2389,7 @@ dependencies = [
name = "uu_comm" name = "uu_comm"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2397,7 +2397,7 @@ dependencies = [
name = "uu_cp" name = "uu_cp"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"exacl", "exacl",
"filetime", "filetime",
"ioctl-sys", "ioctl-sys",
@ -2414,7 +2414,7 @@ dependencies = [
name = "uu_csplit" name = "uu_csplit"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"regex", "regex",
"thiserror", "thiserror",
"uucore", "uucore",
@ -2426,7 +2426,7 @@ version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"bstr", "bstr",
"clap 3.0.10", "clap 3.1.6",
"memchr 2.4.1", "memchr 2.4.1",
"uucore", "uucore",
] ]
@ -2436,7 +2436,7 @@ name = "uu_date"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
"winapi 0.3.9", "winapi 0.3.9",
@ -2447,7 +2447,7 @@ name = "uu_dd"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"byte-unit", "byte-unit",
"clap 3.0.10", "clap 3.1.6",
"gcd", "gcd",
"libc", "libc",
"signal-hook", "signal-hook",
@ -2458,7 +2458,7 @@ dependencies = [
name = "uu_df" name = "uu_df"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"number_prefix", "number_prefix",
"uucore", "uucore",
] ]
@ -2467,7 +2467,7 @@ dependencies = [
name = "uu_dircolors" name = "uu_dircolors"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"glob", "glob",
"uucore", "uucore",
] ]
@ -2476,7 +2476,7 @@ dependencies = [
name = "uu_dirname" name = "uu_dirname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2485,7 +2485,7 @@ name = "uu_du"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
"winapi 0.3.9", "winapi 0.3.9",
] ]
@ -2494,7 +2494,7 @@ dependencies = [
name = "uu_echo" name = "uu_echo"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2502,7 +2502,7 @@ dependencies = [
name = "uu_env" name = "uu_env"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"rust-ini", "rust-ini",
"uucore", "uucore",
] ]
@ -2511,7 +2511,7 @@ dependencies = [
name = "uu_expand" name = "uu_expand"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"unicode-width", "unicode-width",
"uucore", "uucore",
] ]
@ -2520,7 +2520,7 @@ dependencies = [
name = "uu_expr" name = "uu_expr"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"num-bigint", "num-bigint",
"num-traits", "num-traits",
"onig", "onig",
@ -2531,7 +2531,7 @@ dependencies = [
name = "uu_factor" name = "uu_factor"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"coz", "coz",
"num-traits", "num-traits",
"paste", "paste",
@ -2545,7 +2545,7 @@ dependencies = [
name = "uu_false" name = "uu_false"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2553,7 +2553,7 @@ dependencies = [
name = "uu_fmt" name = "uu_fmt"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"unicode-width", "unicode-width",
"uucore", "uucore",
] ]
@ -2562,7 +2562,7 @@ dependencies = [
name = "uu_fold" name = "uu_fold"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2570,7 +2570,7 @@ dependencies = [
name = "uu_groups" name = "uu_groups"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2580,7 +2580,7 @@ version = "0.0.12"
dependencies = [ dependencies = [
"blake2b_simd", "blake2b_simd",
"blake3", "blake3",
"clap 3.0.10", "clap 3.1.6",
"digest", "digest",
"hex", "hex",
"md-5", "md-5",
@ -2596,7 +2596,7 @@ dependencies = [
name = "uu_head" name = "uu_head"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"memchr 2.4.1", "memchr 2.4.1",
"uucore", "uucore",
] ]
@ -2605,7 +2605,7 @@ dependencies = [
name = "uu_hostid" name = "uu_hostid"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2614,7 +2614,7 @@ dependencies = [
name = "uu_hostname" name = "uu_hostname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"hostname", "hostname",
"uucore", "uucore",
"winapi 0.3.9", "winapi 0.3.9",
@ -2624,7 +2624,7 @@ dependencies = [
name = "uu_id" name = "uu_id"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"selinux", "selinux",
"uucore", "uucore",
] ]
@ -2633,7 +2633,7 @@ dependencies = [
name = "uu_install" name = "uu_install"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"file_diff", "file_diff",
"filetime", "filetime",
"libc", "libc",
@ -2644,7 +2644,7 @@ dependencies = [
name = "uu_join" name = "uu_join"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"memchr 2.4.1", "memchr 2.4.1",
"uucore", "uucore",
] ]
@ -2653,7 +2653,7 @@ dependencies = [
name = "uu_kill" name = "uu_kill"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2662,7 +2662,7 @@ dependencies = [
name = "uu_link" name = "uu_link"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2670,7 +2670,7 @@ dependencies = [
name = "uu_ln" name = "uu_ln"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2678,7 +2678,7 @@ dependencies = [
name = "uu_logname" name = "uu_logname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2689,7 +2689,7 @@ version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"chrono", "chrono",
"clap 3.0.10", "clap 3.1.6",
"glob", "glob",
"lazy_static", "lazy_static",
"lscolors", "lscolors",
@ -2706,7 +2706,7 @@ dependencies = [
name = "uu_mkdir" name = "uu_mkdir"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2714,7 +2714,7 @@ dependencies = [
name = "uu_mkfifo" name = "uu_mkfifo"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2723,7 +2723,7 @@ dependencies = [
name = "uu_mknod" name = "uu_mknod"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2732,7 +2732,7 @@ dependencies = [
name = "uu_mktemp" name = "uu_mktemp"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"rand", "rand",
"tempfile", "tempfile",
"uucore", "uucore",
@ -2743,7 +2743,7 @@ name = "uu_more"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap 3.0.10", "clap 3.1.6",
"crossterm", "crossterm",
"nix 0.23.1", "nix 0.23.1",
"unicode-segmentation", "unicode-segmentation",
@ -2755,7 +2755,7 @@ dependencies = [
name = "uu_mv" name = "uu_mv"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"fs_extra", "fs_extra",
"uucore", "uucore",
] ]
@ -2764,7 +2764,7 @@ dependencies = [
name = "uu_nice" name = "uu_nice"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
@ -2774,7 +2774,7 @@ dependencies = [
name = "uu_nl" name = "uu_nl"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"regex", "regex",
"uucore", "uucore",
] ]
@ -2784,7 +2784,7 @@ name = "uu_nohup"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2793,7 +2793,7 @@ dependencies = [
name = "uu_nproc" name = "uu_nproc"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"num_cpus", "num_cpus",
"uucore", "uucore",
@ -2803,7 +2803,7 @@ dependencies = [
name = "uu_numfmt" name = "uu_numfmt"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2812,7 +2812,7 @@ name = "uu_od"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"clap 3.0.10", "clap 3.1.6",
"half", "half",
"uucore", "uucore",
] ]
@ -2821,7 +2821,7 @@ dependencies = [
name = "uu_paste" name = "uu_paste"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2829,7 +2829,7 @@ dependencies = [
name = "uu_pathchk" name = "uu_pathchk"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2838,7 +2838,7 @@ dependencies = [
name = "uu_pinky" name = "uu_pinky"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2847,7 +2847,7 @@ name = "uu_pr"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap 3.0.10", "clap 3.1.6",
"itertools", "itertools",
"quick-error", "quick-error",
"regex", "regex",
@ -2858,7 +2858,7 @@ dependencies = [
name = "uu_printenv" name = "uu_printenv"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2866,7 +2866,7 @@ dependencies = [
name = "uu_printf" name = "uu_printf"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2874,7 +2874,7 @@ dependencies = [
name = "uu_ptx" name = "uu_ptx"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"regex", "regex",
"uucore", "uucore",
] ]
@ -2883,7 +2883,7 @@ dependencies = [
name = "uu_pwd" name = "uu_pwd"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2891,7 +2891,7 @@ dependencies = [
name = "uu_readlink" name = "uu_readlink"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2899,7 +2899,7 @@ dependencies = [
name = "uu_realpath" name = "uu_realpath"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2907,7 +2907,7 @@ dependencies = [
name = "uu_relpath" name = "uu_relpath"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2915,7 +2915,7 @@ dependencies = [
name = "uu_rm" name = "uu_rm"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"remove_dir_all", "remove_dir_all",
"uucore", "uucore",
"walkdir", "walkdir",
@ -2926,7 +2926,7 @@ dependencies = [
name = "uu_rmdir" name = "uu_rmdir"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -2935,7 +2935,7 @@ dependencies = [
name = "uu_runcon" name = "uu_runcon"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"selinux", "selinux",
"thiserror", "thiserror",
@ -2947,7 +2947,7 @@ name = "uu_seq"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"bigdecimal", "bigdecimal",
"clap 3.0.10", "clap 3.1.6",
"num-bigint", "num-bigint",
"num-traits", "num-traits",
"uucore", "uucore",
@ -2957,7 +2957,7 @@ dependencies = [
name = "uu_shred" name = "uu_shred"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"rand", "rand",
"uucore", "uucore",
] ]
@ -2966,7 +2966,7 @@ dependencies = [
name = "uu_shuf" name = "uu_shuf"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"rand", "rand",
"rand_core", "rand_core",
"uucore", "uucore",
@ -2976,7 +2976,7 @@ dependencies = [
name = "uu_sleep" name = "uu_sleep"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -2985,7 +2985,7 @@ name = "uu_sort"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"binary-heap-plus", "binary-heap-plus",
"clap 3.0.10", "clap 3.1.6",
"compare", "compare",
"ctrlc", "ctrlc",
"fnv", "fnv",
@ -3003,7 +3003,7 @@ dependencies = [
name = "uu_split" name = "uu_split"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"memchr 2.4.1", "memchr 2.4.1",
"uucore", "uucore",
] ]
@ -3012,7 +3012,7 @@ dependencies = [
name = "uu_stat" name = "uu_stat"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3020,7 +3020,7 @@ dependencies = [
name = "uu_stdbuf" name = "uu_stdbuf"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"tempfile", "tempfile",
"uu_stdbuf_libstdbuf", "uu_stdbuf_libstdbuf",
"uucore", "uucore",
@ -3040,7 +3040,7 @@ dependencies = [
name = "uu_sum" name = "uu_sum"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3048,7 +3048,7 @@ dependencies = [
name = "uu_sync" name = "uu_sync"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
"winapi 0.3.9", "winapi 0.3.9",
@ -3058,7 +3058,7 @@ dependencies = [
name = "uu_tac" name = "uu_tac"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"memchr 2.4.1", "memchr 2.4.1",
"memmap2", "memmap2",
"regex", "regex",
@ -3069,7 +3069,7 @@ dependencies = [
name = "uu_tail" name = "uu_tail"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
@ -3080,7 +3080,7 @@ dependencies = [
name = "uu_tee" name = "uu_tee"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"retain_mut", "retain_mut",
"uucore", "uucore",
@ -3090,7 +3090,7 @@ dependencies = [
name = "uu_test" name = "uu_test"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"redox_syscall", "redox_syscall",
"uucore", "uucore",
@ -3100,7 +3100,7 @@ dependencies = [
name = "uu_timeout" name = "uu_timeout"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
@ -3110,7 +3110,7 @@ dependencies = [
name = "uu_touch" name = "uu_touch"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"filetime", "filetime",
"time", "time",
"uucore", "uucore",
@ -3121,7 +3121,7 @@ dependencies = [
name = "uu_tr" name = "uu_tr"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"nom", "nom",
"uucore", "uucore",
] ]
@ -3130,7 +3130,7 @@ dependencies = [
name = "uu_true" name = "uu_true"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3138,7 +3138,7 @@ dependencies = [
name = "uu_truncate" name = "uu_truncate"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3146,7 +3146,7 @@ dependencies = [
name = "uu_tsort" name = "uu_tsort"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3155,7 +3155,7 @@ name = "uu_tty"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"atty", "atty",
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
] ]
@ -3164,7 +3164,7 @@ dependencies = [
name = "uu_uname" name = "uu_uname"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"platform-info", "platform-info",
"uucore", "uucore",
] ]
@ -3173,7 +3173,7 @@ dependencies = [
name = "uu_unexpand" name = "uu_unexpand"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"unicode-width", "unicode-width",
"uucore", "uucore",
] ]
@ -3182,7 +3182,7 @@ dependencies = [
name = "uu_uniq" name = "uu_uniq"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"strum", "strum",
"strum_macros", "strum_macros",
"uucore", "uucore",
@ -3192,7 +3192,7 @@ dependencies = [
name = "uu_unlink" name = "uu_unlink"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3201,7 +3201,7 @@ name = "uu_uptime"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3209,7 +3209,7 @@ dependencies = [
name = "uu_users" name = "uu_users"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3218,7 +3218,7 @@ name = "uu_wc"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"bytecount", "bytecount",
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"nix 0.23.1", "nix 0.23.1",
"unicode-width", "unicode-width",
@ -3230,7 +3230,7 @@ dependencies = [
name = "uu_who" name = "uu_who"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"uucore", "uucore",
] ]
@ -3238,7 +3238,7 @@ dependencies = [
name = "uu_whoami" name = "uu_whoami"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"libc", "libc",
"uucore", "uucore",
"winapi 0.3.9", "winapi 0.3.9",
@ -3248,7 +3248,7 @@ dependencies = [
name = "uu_yes" name = "uu_yes"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"nix 0.23.1", "nix 0.23.1",
"uucore", "uucore",
] ]
@ -3257,7 +3257,7 @@ dependencies = [
name = "uucore" name = "uucore"
version = "0.0.12" version = "0.0.12"
dependencies = [ dependencies = [
"clap 3.0.10", "clap 3.1.6",
"data-encoding", "data-encoding",
"data-encoding-macro", "data-encoding-macro",
"dns-lookup", "dns-lookup",

View file

@ -245,11 +245,11 @@ test = [ "uu_test" ]
[workspace] [workspace]
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
clap_complete = "3.0" clap_complete = "3.0"
phf = "0.10.1" phf = "0.10.1"
lazy_static = { version="1.3" } lazy_static = { version="1.3" }
textwrap = { version="0.14", features=["terminal_size"] } textwrap = { version="0.15", features=["terminal_size"] }
uucore = { version=">=0.0.11", package="uucore", path="src/uucore" } uucore = { version=">=0.0.11", package="uucore", path="src/uucore" }
selinux = { version="0.2", optional = true } selinux = { version="0.2", optional = true }
ureq = "2.4.0" ureq = "2.4.0"

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> = phf::Map<&'static str, (fn(T) -> i32, fn() -> App<'static>)>;\n\ "type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command<'static>)>;\n\
\n\ \n\
fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n" fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n"
.as_bytes(), .as_bytes(),

View file

@ -40,6 +40,8 @@ TARGETS = [
"x86_64-linux-android", "x86_64-linux-android",
# Solaris # Solaris
"x86_64-sun-solaris", "x86_64-sun-solaris",
# Illumos
"x86_64-unknown-illumos",
# WASM # WASM
"wasm32-wasi", "wasm32-wasi",
# Redox # Redox

View file

@ -5,7 +5,7 @@
// 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, Arg}; use clap::{Arg, Command};
use clap_complete::Shell; use clap_complete::Shell;
use std::cmp; use std::cmp;
use std::ffi::OsStr; use std::ffi::OsStr;
@ -138,7 +138,7 @@ fn gen_completions<T: uucore::Args>(
.chain(util_map.keys().copied()) .chain(util_map.keys().copied())
.collect(); .collect();
let matches = App::new("completion") let matches = Command::new("completion")
.about("Prints completions to stdout") .about("Prints completions to stdout")
.arg( .arg(
Arg::new("utility") Arg::new("utility")
@ -155,7 +155,7 @@ fn gen_completions<T: uucore::Args>(
let utility = matches.value_of("utility").unwrap(); let utility = matches.value_of("utility").unwrap();
let shell = matches.value_of("shell").unwrap(); let shell = matches.value_of("shell").unwrap();
let mut app = if utility == "coreutils" { let mut command = if utility == "coreutils" {
gen_coreutils_app(util_map) gen_coreutils_app(util_map)
} else { } else {
util_map.get(utility).unwrap().1() util_map.get(utility).unwrap().1()
@ -163,15 +163,15 @@ 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;
clap_complete::generate(shell, &mut app, bin_name, &mut io::stdout()); clap_complete::generate(shell, &mut command, 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> { fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command<'static> {
let mut app = App::new("coreutils"); let mut command = Command::new("coreutils");
for (_, (_, sub_app)) in util_map { for (_, (_, sub_app)) in util_map {
app = app.subcommand(sub_app()); command = command.subcommand(sub_app());
} }
app command
} }

View file

@ -4,7 +4,7 @@
// file that was distributed with this source code. // file that was distributed with this source code.
// spell-checker:ignore tldr // spell-checker:ignore tldr
use clap::App; use clap::Command;
use std::ffi::OsString; use std::ffi::OsString;
use std::fs::File; use std::fs::File;
use std::io::Cursor; use std::io::Cursor;
@ -46,13 +46,13 @@ fn main() -> io::Result<()> {
let mut utils = utils.entries().collect::<Vec<_>>(); let mut utils = utils.entries().collect::<Vec<_>>();
utils.sort(); utils.sort();
for (&name, (_, app)) in utils { for (&name, (_, command)) in utils {
if name == "[" { if name == "[" {
continue; continue;
} }
let p = format!("docs/src/utils/{}.md", name); let p = format!("docs/src/utils/{}.md", name);
if let Ok(f) = File::create(&p) { if let Ok(f) = File::create(&p) {
write_markdown(f, &mut app(), name, &mut tldr_zip)?; write_markdown(f, &mut command(), name, &mut tldr_zip)?;
println!("Wrote to '{}'", p); println!("Wrote to '{}'", p);
} else { } else {
println!("Error writing to {}", p); println!("Error writing to {}", p);
@ -64,29 +64,29 @@ fn main() -> io::Result<()> {
fn write_markdown( fn write_markdown(
mut w: impl Write, mut w: impl Write,
app: &mut App, command: &mut Command,
name: &str, name: &str,
tldr_zip: &mut zip::ZipArchive<impl Read + Seek>, tldr_zip: &mut zip::ZipArchive<impl Read + Seek>,
) -> io::Result<()> { ) -> io::Result<()> {
write!(w, "# {}\n\n", name)?; write!(w, "# {}\n\n", name)?;
write_version(&mut w, app)?; write_version(&mut w, command)?;
write_usage(&mut w, app, name)?; write_usage(&mut w, command, name)?;
write_description(&mut w, app)?; write_description(&mut w, command)?;
write_options(&mut w, app)?; write_options(&mut w, command)?;
write_examples(&mut w, name, tldr_zip) write_examples(&mut w, name, tldr_zip)
} }
fn write_version(w: &mut impl Write, app: &App) -> io::Result<()> { fn write_version(w: &mut impl Write, command: &Command) -> io::Result<()> {
writeln!( writeln!(
w, w,
"<div class=\"version\">version: {}</div>", "<div class=\"version\">version: {}</div>",
app.render_version().split_once(' ').unwrap().1 command.render_version().split_once(' ').unwrap().1
) )
} }
fn write_usage(w: &mut impl Write, app: &mut App, name: &str) -> io::Result<()> { fn write_usage(w: &mut impl Write, command: &mut Command, name: &str) -> io::Result<()> {
writeln!(w, "\n```")?; writeln!(w, "\n```")?;
let mut usage: String = app let mut usage: String = command
.render_usage() .render_usage()
.lines() .lines()
.skip(1) .skip(1)
@ -99,8 +99,8 @@ fn write_usage(w: &mut impl Write, app: &mut App, name: &str) -> io::Result<()>
writeln!(w, "```") writeln!(w, "```")
} }
fn write_description(w: &mut impl Write, app: &App) -> io::Result<()> { fn write_description(w: &mut impl Write, command: &Command) -> io::Result<()> {
if let Some(about) = app.get_long_about().or_else(|| app.get_about()) { if let Some(about) = command.get_long_about().or_else(|| command.get_about()) {
writeln!(w, "{}", about) writeln!(w, "{}", about)
} else { } else {
Ok(()) Ok(())
@ -152,10 +152,10 @@ fn get_zip_content(archive: &mut ZipArchive<impl Read + Seek>, name: &str) -> Op
Some(s) Some(s)
} }
fn write_options(w: &mut impl Write, app: &App) -> io::Result<()> { fn write_options(w: &mut impl Write, command: &Command) -> io::Result<()> {
writeln!(w, "<h2>Options</h2>")?; writeln!(w, "<h2>Options</h2>")?;
write!(w, "<dl>")?; write!(w, "<dl>")?;
for arg in app.get_arguments() { for arg in command.get_arguments() {
write!(w, "<dt>")?; write!(w, "<dt>")?;
let mut first = true; let mut first = true;
for l in arg.get_long_and_visible_aliases().unwrap_or_default() { for l in arg.get_long_and_visible_aliases().unwrap_or_default() {

View file

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

View file

@ -8,7 +8,7 @@
use platform_info::*; use platform_info::*;
use clap::{crate_version, App, AppSettings}; use clap::{crate_version, Command};
use uucore::error::{FromIo, UResult}; use uucore::error::{FromIo, UResult};
static ABOUT: &str = "Display machine architecture"; static ABOUT: &str = "Display machine architecture";
@ -23,10 +23,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.after_help(SUMMARY) .after_help(SUMMARY)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/base32.rs" path = "src/base32.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
[[bin]] [[bin]]

View file

@ -7,7 +7,7 @@
use std::io::{stdin, Read}; use std::io::{stdin, Read};
use clap::App; use clap::Command;
use uucore::{encoding::Format, error::UResult}; use uucore::{encoding::Format, error::UResult};
pub mod base_common; pub mod base_common;
@ -44,6 +44,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
) )
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
base_common::base_app(ABOUT, USAGE) base_common::base_app(ABOUT, USAGE)
} }

View file

@ -18,7 +18,7 @@ use std::fs::File;
use std::io::{BufReader, Stdin}; use std::io::{BufReader, Stdin};
use std::path::Path; use std::path::Path;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
pub static BASE_CMD_PARSE_ERROR: i32 = 1; pub static BASE_CMD_PARSE_ERROR: i32 = 1;
@ -86,19 +86,19 @@ 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); let command = base_app(about, 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(&command.get_matches_from(arg_list))
} }
pub fn base_app<'a>(about: &'a str, usage: &'a str) -> App<'a> { pub fn base_app<'a>(about: &'a str, usage: &'a str) -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(about) .about(about)
.override_usage(format_usage(usage)) .override_usage(format_usage(usage))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
// Format arguments. // Format arguments.
.arg( .arg(
Arg::new(options::DECODE) Arg::new(options::DECODE)

View file

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

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) fullname // spell-checker:ignore (ToDO) fullname
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::path::{is_separator, PathBuf}; use std::path::{is_separator, PathBuf};
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{UResult, UUsageError}; use uucore::error::{UResult, UUsageError};
@ -87,12 +87,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::MULTIPLE) Arg::new(options::MULTIPLE)
.short('a') .short('a')

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/basenc.rs" path = "src/basenc.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"} uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"}

View file

@ -8,7 +8,7 @@
//spell-checker:ignore (args) lsbf msbf //spell-checker:ignore (args) lsbf msbf
use clap::{App, Arg}; use clap::{Arg, Command};
use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR}; use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};
use uucore::{ use uucore::{
@ -40,12 +40,12 @@ const ENCODINGS: &[(&str, Format)] = &[
const USAGE: &str = "{} [OPTION]... [FILE]"; const USAGE: &str = "{} [OPTION]... [FILE]";
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
let mut app = base_common::base_app(ABOUT, USAGE); let mut command = base_common::base_app(ABOUT, USAGE);
for encoding in ENCODINGS { for encoding in ENCODINGS {
app = app.arg(Arg::new(encoding.0).long(encoding.0)); command = command.arg(Arg::new(encoding.0).long(encoding.0));
} }
app command
} }
fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> { fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/cat.rs" path = "src/cat.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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

@ -14,7 +14,7 @@
extern crate unix_socket; extern crate unix_socket;
// last synced with: cat (GNU coreutils) 8.13 // last synced with: cat (GNU coreutils) 8.13
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::fs::{metadata, File}; use std::fs::{metadata, File};
use std::io::{self, Read, Write}; use std::io::{self, Read, Write};
use thiserror::Error; use thiserror::Error;
@ -239,13 +239,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
cat_files(&files, &options) cat_files(&files, &options)
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(SUMMARY)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)
.hide(true) .hide(true)

View file

@ -14,7 +14,7 @@ edition = "2018"
path = "src/chcon.rs" path = "src/chcon.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
selinux = { version = "0.2" } selinux = { version = "0.2" }
fts-sys = { version = "0.2" } fts-sys = { version = "0.2" }

View file

@ -6,7 +6,7 @@ use uucore::error::{UResult, USimpleError, UUsageError};
use uucore::format_usage; use uucore::format_usage;
use uucore::{display::Quotable, show_error, show_warning}; use uucore::{display::Quotable, show_error, show_warning};
use clap::{App, AppSettings, Arg}; use clap::{Arg, Command};
use selinux::{OpaqueSecurityContext, SecurityContext}; use selinux::{OpaqueSecurityContext, SecurityContext};
use std::borrow::Cow; use std::borrow::Cow;
@ -29,6 +29,7 @@ const USAGE: &str = "\
{} [OPTION]... --reference=RFILE FILE..."; {} [OPTION]... --reference=RFILE FILE...";
pub mod options { pub mod options {
pub static HELP: &str = "help";
pub static VERBOSE: &str = "verbose"; pub static VERBOSE: &str = "verbose";
pub static REFERENCE: &str = "reference"; pub static REFERENCE: &str = "reference";
@ -65,7 +66,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
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::DisplayHelp | clap::ErrorKind::DisplayVersion => { clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => {
println!("{}", r); println!("{}", r);
return Ok(()); return Ok(());
@ -154,12 +155,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Err(libc::EXIT_FAILURE.into()) Err(libc::EXIT_FAILURE.into())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(VERSION) .version(VERSION)
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information."),
)
.arg( .arg(
Arg::new(options::dereference::DEREFERENCE) Arg::new(options::dereference::DEREFERENCE)
.long(options::dereference::DEREFERENCE) .long(options::dereference::DEREFERENCE)
@ -303,7 +309,7 @@ struct Options {
files: Vec<PathBuf>, files: Vec<PathBuf>,
} }
fn parse_command_line(config: clap::App, args: impl uucore::Args) -> Result<Options> { fn parse_command_line(config: clap::Command, args: impl uucore::Args) -> Result<Options> {
let matches = config.try_get_matches_from(args)?; let matches = config.try_get_matches_from(args)?;
let verbose = matches.is_present(options::VERBOSE); let verbose = matches.is_present(options::VERBOSE);
@ -402,23 +408,21 @@ enum RecursiveMode {
impl RecursiveMode { impl RecursiveMode {
fn is_recursive(self) -> bool { fn is_recursive(self) -> bool {
match self { match self {
RecursiveMode::NotRecursive => false, Self::NotRecursive => false,
RecursiveMode::RecursiveButDoNotFollowSymLinks Self::RecursiveButDoNotFollowSymLinks
| RecursiveMode::RecursiveAndFollowAllDirSymLinks | Self::RecursiveAndFollowAllDirSymLinks
| RecursiveMode::RecursiveAndFollowArgDirSymLinks => true, | Self::RecursiveAndFollowArgDirSymLinks => true,
} }
} }
fn fts_open_options(self) -> c_int { fn fts_open_options(self) -> c_int {
match self { match self {
RecursiveMode::NotRecursive | RecursiveMode::RecursiveButDoNotFollowSymLinks => { Self::NotRecursive | Self::RecursiveButDoNotFollowSymLinks => fts_sys::FTS_PHYSICAL,
fts_sys::FTS_PHYSICAL
}
RecursiveMode::RecursiveAndFollowAllDirSymLinks => fts_sys::FTS_LOGICAL, Self::RecursiveAndFollowAllDirSymLinks => fts_sys::FTS_LOGICAL,
RecursiveMode::RecursiveAndFollowArgDirSymLinks => { Self::RecursiveAndFollowArgDirSymLinks => {
fts_sys::FTS_PHYSICAL | fts_sys::FTS_COMFOLLOW fts_sys::FTS_PHYSICAL | fts_sys::FTS_COMFOLLOW
} }
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chgrp.rs" path = "src/chgrp.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
[[bin]] [[bin]]

View file

@ -13,7 +13,7 @@ use uucore::error::{FromIo, UResult, USimpleError};
use uucore::format_usage; use uucore::format_usage;
use uucore::perms::{chown_base, options, IfFrom}; use uucore::perms::{chown_base, options, IfFrom};
use clap::{App, AppSettings, Arg, ArgMatches}; use clap::{Arg, ArgMatches, Command};
use std::fs; use std::fs;
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
@ -54,12 +54,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
chown_base(uu_app(), args, options::ARG_GROUP, parse_gid_and_uid, true) chown_base(uu_app(), args, options::ARG_GROUP, parse_gid_and_uid, true)
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(VERSION) .version(VERSION)
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information.")
)
.arg( .arg(
Arg::new(options::verbosity::CHANGES) Arg::new(options::verbosity::CHANGES)
.short('c') .short('c')

View file

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

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's // spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::fs; use std::fs;
use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::path::Path; use std::path::Path;
@ -112,12 +112,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
chmoder.chmod(&files) chmoder.chmod(&files)
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::CHANGES) Arg::new(options::CHANGES)
.long(options::CHANGES) .long(options::CHANGES)

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chown.rs" path = "src/chown.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
[[bin]] [[bin]]

View file

@ -14,7 +14,7 @@ use uucore::perms::{chown_base, options, IfFrom};
use uucore::error::{FromIo, UResult, USimpleError}; use uucore::error::{FromIo, UResult, USimpleError};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use std::fs; use std::fs;
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
@ -63,12 +63,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
) )
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information."),
)
.arg( .arg(
Arg::new(options::verbosity::CHANGES) Arg::new(options::verbosity::CHANGES)
.short('c') .short('c')

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/chroot.rs" path = "src/chroot.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
[[bin]] [[bin]]

View file

@ -10,11 +10,11 @@
mod error; mod error;
use crate::error::ChrootError; use crate::error::ChrootError;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::ffi::CString; use std::ffi::CString;
use std::io::Error; use std::io::Error;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process;
use uucore::error::{set_exit_code, UResult}; use uucore::error::{set_exit_code, UResult};
use uucore::libc::{self, chroot, setgid, setgroups, setuid}; use uucore::libc::{self, chroot, setgid, setgroups, setuid};
use uucore::{entries, format_usage, InvalidEncodingHandling}; use uucore::{entries, format_usage, InvalidEncodingHandling};
@ -77,7 +77,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// NOTE: Tests can only trigger code beyond this point if they're invoked with root permissions // NOTE: Tests can only trigger code beyond this point if they're invoked with root permissions
set_context(newroot, &matches)?; set_context(newroot, &matches)?;
let pstatus = match Command::new(chroot_command).args(chroot_args).status() { let pstatus = match process::Command::new(chroot_command)
.args(chroot_args)
.status()
{
Ok(status) => status, Ok(status) => status,
Err(e) => return Err(ChrootError::CommandFailed(command[0].to_string(), e).into()), Err(e) => return Err(ChrootError::CommandFailed(command[0].to_string(), e).into()),
}; };
@ -91,12 +94,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::NEWROOT) Arg::new(options::NEWROOT)
.hide(true) .hide(true)

View file

@ -55,25 +55,25 @@ impl UError for ChrootError {
impl Display for ChrootError { impl Display for ChrootError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self { match self {
ChrootError::CannotEnter(s, e) => write!(f, "cannot chroot to {}: {}", s.quote(), e,), Self::CannotEnter(s, e) => write!(f, "cannot chroot to {}: {}", s.quote(), e,),
ChrootError::CommandFailed(s, e) => { Self::CommandFailed(s, e) => {
write!(f, "failed to run command {}: {}", s.to_string().quote(), e,) write!(f, "failed to run command {}: {}", s.to_string().quote(), e,)
} }
ChrootError::InvalidUserspec(s) => write!(f, "invalid userspec: {}", s.quote(),), Self::InvalidUserspec(s) => write!(f, "invalid userspec: {}", s.quote(),),
ChrootError::MissingNewRoot => write!( Self::MissingNewRoot => write!(
f, f,
"Missing operand: NEWROOT\nTry '{} --help' for more information.", "Missing operand: NEWROOT\nTry '{} --help' for more information.",
uucore::execution_phrase(), uucore::execution_phrase(),
), ),
ChrootError::NoSuchGroup(s) => write!(f, "no such group: {}", s.maybe_quote(),), Self::NoSuchGroup(s) => write!(f, "no such group: {}", s.maybe_quote(),),
ChrootError::NoSuchDirectory(s) => write!( Self::NoSuchDirectory(s) => write!(
f, f,
"cannot change root directory to {}: no such directory", "cannot change root directory to {}: no such directory",
s.quote(), s.quote(),
), ),
ChrootError::SetGidFailed(s, e) => write!(f, "cannot set gid to {}: {}", s, e), Self::SetGidFailed(s, e) => write!(f, "cannot set gid to {}: {}", s, e),
ChrootError::SetGroupsFailed(e) => write!(f, "cannot set groups: {}", e), Self::SetGroupsFailed(e) => write!(f, "cannot set groups: {}", e),
ChrootError::SetUserFailed(s, e) => { Self::SetUserFailed(s, e) => {
write!(f, "cannot set user to {}: {}", s.maybe_quote(), e) write!(f, "cannot set user to {}: {}", s.maybe_quote(), e)
} }
} }

View file

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

View file

@ -6,7 +6,7 @@
// file that was distributed with this source code. // file that was distributed with this source code.
// spell-checker:ignore (ToDO) fname // spell-checker:ignore (ToDO) fname
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::fs::File; use std::fs::File;
use std::io::{self, stdin, BufReader, Read}; use std::io::{self, stdin, BufReader, Read};
use std::path::Path; use std::path::Path;
@ -140,13 +140,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILE) Arg::new(options::FILE)
.hide(true) .hide(true)

View file

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

View file

@ -15,7 +15,7 @@ use uucore::error::FromIo;
use uucore::error::UResult; use uucore::error::UResult;
use uucore::{format_usage, InvalidEncodingHandling}; use uucore::{format_usage, InvalidEncodingHandling};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
static ABOUT: &str = "compare two sorted files line by line"; static ABOUT: &str = "compare two sorted files line by line";
static LONG_HELP: &str = ""; static LONG_HELP: &str = "";
@ -143,13 +143,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::COLUMN_1) Arg::new(options::COLUMN_1)
.short('1') .short('1')

View file

@ -19,9 +19,9 @@ edition = "2018"
path = "src/cp.rs" path = "src/cp.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
filetime = "0.2" filetime = "0.2"
libc = "0.2.85" libc = "0.2.121"
quick-error = "2.0.1" quick-error = "2.0.1"
selinux = { version="0.2", optional=true } selinux = { version="0.2", optional=true }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] } uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["entries", "fs", "perms", "mode"] }

View file

@ -28,7 +28,7 @@ use winapi::um::fileapi::GetFileInformationByHandle;
use std::borrow::Cow; use std::borrow::Cow;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use filetime::FileTime; use filetime::FileTime;
#[cfg(unix)] #[cfg(unix)]
use libc::mkfifo; use libc::mkfifo;
@ -296,7 +296,7 @@ static DEFAULT_ATTRIBUTES: &[Attribute] = &[
Attribute::Timestamps, Attribute::Timestamps,
]; ];
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
const MODE_ARGS: &[&str] = &[ const MODE_ARGS: &[&str] = &[
options::LINK, options::LINK,
options::REFLINK, options::REFLINK,
@ -304,17 +304,23 @@ pub fn uu_app<'a>() -> App<'a> {
options::ATTRIBUTES_ONLY, options::ATTRIBUTES_ONLY,
options::COPY_CONTENTS, options::COPY_CONTENTS,
]; ];
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(Arg::new(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)
.validator(|s| {
if Path::new(s).is_dir() {
return Ok(());
}
Err(format!("'{}' is not a directory", s))
})
.help("copy all SOURCE arguments into target-directory")) .help("copy all SOURCE arguments into target-directory"))
.arg(Arg::new(options::NO_TARGET_DIRECTORY) .arg(Arg::new(options::NO_TARGET_DIRECTORY)
.short('T') .short('T')
@ -389,7 +395,7 @@ pub fn uu_app<'a>() -> App<'a> {
.long(options::PRESERVE) .long(options::PRESERVE)
.takes_value(true) .takes_value(true)
.multiple_occurrences(true) .multiple_occurrences(true)
.use_delimiter(true) .use_value_delimiter(true)
.possible_values(PRESERVABLE_ATTRIBUTES) .possible_values(PRESERVABLE_ATTRIBUTES)
.min_values(0) .min_values(0)
.value_name("ATTR_LIST") .value_name("ATTR_LIST")
@ -469,7 +475,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
)) ))
.get_matches_from(args); .try_get_matches_from(args)?;
let options = Options::from_matches(&matches)?; let options = Options::from_matches(&matches)?;
@ -1087,8 +1093,8 @@ fn copy_directory(
impl OverwriteMode { impl OverwriteMode {
fn verify(&self, path: &Path) -> CopyResult<()> { fn verify(&self, path: &Path) -> CopyResult<()> {
match *self { match *self {
OverwriteMode::NoClobber => Err(Error::NotAllFilesCopied), Self::NoClobber => Err(Error::NotAllFilesCopied),
OverwriteMode::Interactive(_) => { Self::Interactive(_) => {
if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) { if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) {
Ok(()) Ok(())
} else { } else {
@ -1098,7 +1104,7 @@ impl OverwriteMode {
))) )))
} }
} }
OverwriteMode::Clobber(_) => Ok(()), Self::Clobber(_) => Ok(()),
} }
} }
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/csplit.rs" path = "src/csplit.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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

@ -12,7 +12,7 @@ use std::{
io::{BufRead, BufWriter, Write}, io::{BufRead, BufWriter, Write},
}; };
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use regex::Regex; use regex::Regex;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{FromIo, UResult}; use uucore::error::{FromIo, UResult};
@ -746,12 +746,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::SUFFIX_FORMAT) Arg::new(options::SUFFIX_FORMAT)
.short('b') .short('b')

View file

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

View file

@ -11,7 +11,7 @@
extern crate uucore; extern crate uucore;
use bstr::io::BufReadExt; use bstr::io::BufReadExt;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::fs::File; use std::fs::File;
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
use std::path::Path; use std::path::Path;
@ -533,14 +533,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(SUMMARY)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES) Arg::new(options::BYTES)
.short('b') .short('b')

View file

@ -16,7 +16,7 @@ path = "src/date.rs"
[dependencies] [dependencies]
chrono = "^0.4.11" chrono = "^0.4.11"
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]

View file

@ -11,7 +11,7 @@
use chrono::{DateTime, FixedOffset, Local, Offset, Utc}; use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
#[cfg(windows)] #[cfg(windows)]
use chrono::{Datelike, Timelike}; use chrono::{Datelike, Timelike};
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))] #[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
use libc::{clock_settime, timespec, CLOCK_REALTIME}; use libc::{clock_settime, timespec, CLOCK_REALTIME};
use std::fs::File; use std::fs::File;
@ -254,12 +254,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_DATE) Arg::new(OPT_DATE)
.short('d') .short('d')

View file

@ -16,7 +16,7 @@ path = "src/dd.rs"
[dependencies] [dependencies]
byte-unit = "4.0" byte-unit = "4.0"
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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

@ -4,7 +4,7 @@
// //
// 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.
// spell-checker:ignore ctable, outfile // spell-checker:ignore ctable, outfile, iseek, oseek
use std::error::Error; use std::error::Error;
@ -120,6 +120,8 @@ pub mod options {
pub const COUNT: &str = "count"; pub const COUNT: &str = "count";
pub const SKIP: &str = "skip"; pub const SKIP: &str = "skip";
pub const SEEK: &str = "seek"; pub const SEEK: &str = "seek";
pub const ISEEK: &str = "iseek";
pub const OSEEK: &str = "oseek";
pub const STATUS: &str = "status"; pub const STATUS: &str = "status";
pub const CONV: &str = "conv"; pub const CONV: &str = "conv";
pub const IFLAG: &str = "iflag"; pub const IFLAG: &str = "iflag";

View file

@ -5,7 +5,7 @@
// 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.
// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, behaviour, bmax, bremain, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, outfile, parseargs, rlen, rmax, rremain, rsofar, rstat, sigusr, wlen, wstat seekable // spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, behaviour, bmax, bremain, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, iseek, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, oseek, outfile, parseargs, rlen, rmax, rremain, rsofar, rstat, sigusr, wlen, wstat seekable
mod datastructures; mod datastructures;
use datastructures::*; use datastructures::*;
@ -34,7 +34,7 @@ use std::sync::mpsc;
use std::thread; use std::thread;
use std::time; use std::time;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use gcd::Gcd; use gcd::Gcd;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{FromIo, UResult}; use uucore::error::{FromIo, UResult};
@ -60,7 +60,9 @@ impl Input<io::Stdin> {
let print_level = parseargs::parse_status_level(matches)?; let print_level = parseargs::parse_status_level(matches)?;
let cflags = parseargs::parse_conv_flag_input(matches)?; let cflags = parseargs::parse_conv_flag_input(matches)?;
let iflags = parseargs::parse_iflags(matches)?; let iflags = parseargs::parse_iflags(matches)?;
let skip = parseargs::parse_skip_amt(&ibs, &iflags, matches)?; let skip = parseargs::parse_seek_skip_amt(&ibs, iflags.skip_bytes, matches, options::SKIP)?;
let iseek =
parseargs::parse_seek_skip_amt(&ibs, iflags.skip_bytes, matches, options::ISEEK)?;
let count = parseargs::parse_count(&iflags, matches)?; let count = parseargs::parse_count(&iflags, matches)?;
let mut i = Self { let mut i = Self {
@ -73,7 +75,9 @@ impl Input<io::Stdin> {
iflags, iflags,
}; };
if let Some(amt) = skip { // The --skip and --iseek flags are additive. On a stream, they discard bytes.
let amt = skip.unwrap_or(0) + iseek.unwrap_or(0);
if amt > 0 {
if let Err(e) = i.read_skip(amt) { if let Err(e) = i.read_skip(amt) {
if let io::ErrorKind::UnexpectedEof = e.kind() { if let io::ErrorKind::UnexpectedEof = e.kind() {
show_error!("'standard input': cannot skip to specified offset"); show_error!("'standard input': cannot skip to specified offset");
@ -131,7 +135,9 @@ impl Input<File> {
let print_level = parseargs::parse_status_level(matches)?; let print_level = parseargs::parse_status_level(matches)?;
let cflags = parseargs::parse_conv_flag_input(matches)?; let cflags = parseargs::parse_conv_flag_input(matches)?;
let iflags = parseargs::parse_iflags(matches)?; let iflags = parseargs::parse_iflags(matches)?;
let skip = parseargs::parse_skip_amt(&ibs, &iflags, matches)?; let skip = parseargs::parse_seek_skip_amt(&ibs, iflags.skip_bytes, matches, options::SKIP)?;
let iseek =
parseargs::parse_seek_skip_amt(&ibs, iflags.skip_bytes, matches, options::ISEEK)?;
let count = parseargs::parse_count(&iflags, matches)?; let count = parseargs::parse_count(&iflags, matches)?;
if let Some(fname) = matches.value_of(options::INFILE) { if let Some(fname) = matches.value_of(options::INFILE) {
@ -148,7 +154,9 @@ impl Input<File> {
.map_err_context(|| "failed to open input file".to_string())? .map_err_context(|| "failed to open input file".to_string())?
}; };
if let Some(amt) = skip { // The --skip and --iseek flags are additive. On a file, they seek.
let amt = skip.unwrap_or(0) + iseek.unwrap_or(0);
if amt > 0 {
src.seek(io::SeekFrom::Start(amt)) src.seek(io::SeekFrom::Start(amt))
.map_err_context(|| "failed to seek in input file".to_string())?; .map_err_context(|| "failed to seek in input file".to_string())?;
} }
@ -292,12 +300,16 @@ impl OutputTrait for Output<io::Stdout> {
let obs = parseargs::parse_obs(matches)?; let obs = parseargs::parse_obs(matches)?;
let cflags = parseargs::parse_conv_flag_output(matches)?; let cflags = parseargs::parse_conv_flag_output(matches)?;
let oflags = parseargs::parse_oflags(matches)?; let oflags = parseargs::parse_oflags(matches)?;
let seek = parseargs::parse_seek_amt(&obs, &oflags, matches)?; let seek = parseargs::parse_seek_skip_amt(&obs, oflags.seek_bytes, matches, options::SEEK)?;
let oseek =
parseargs::parse_seek_skip_amt(&obs, oflags.seek_bytes, matches, options::OSEEK)?;
let mut dst = io::stdout(); let mut dst = io::stdout();
// The --seek and --oseek flags are additive.
let amt = seek.unwrap_or(0) + oseek.unwrap_or(0);
// stdout is not seekable, so we just write null bytes. // stdout is not seekable, so we just write null bytes.
if let Some(amt) = seek { if amt > 0 {
io::copy(&mut io::repeat(0u8).take(amt as u64), &mut dst) io::copy(&mut io::repeat(0u8).take(amt as u64), &mut dst)
.map_err_context(|| String::from("write error"))?; .map_err_context(|| String::from("write error"))?;
} }
@ -508,7 +520,9 @@ impl OutputTrait for Output<File> {
let obs = parseargs::parse_obs(matches)?; let obs = parseargs::parse_obs(matches)?;
let cflags = parseargs::parse_conv_flag_output(matches)?; let cflags = parseargs::parse_conv_flag_output(matches)?;
let oflags = parseargs::parse_oflags(matches)?; let oflags = parseargs::parse_oflags(matches)?;
let seek = parseargs::parse_seek_amt(&obs, &oflags, matches)?; let seek = parseargs::parse_seek_skip_amt(&obs, oflags.seek_bytes, matches, options::SEEK)?;
let oseek =
parseargs::parse_seek_skip_amt(&obs, oflags.seek_bytes, matches, options::OSEEK)?;
if let Some(fname) = matches.value_of(options::OUTFILE) { if let Some(fname) = matches.value_of(options::OUTFILE) {
let mut dst = open_dst(Path::new(&fname), &cflags, &oflags) let mut dst = open_dst(Path::new(&fname), &cflags, &oflags)
@ -522,7 +536,9 @@ impl OutputTrait for Output<File> {
// Instead, we suppress the error by calling // Instead, we suppress the error by calling
// `Result::ok()`. This matches the behavior of GNU `dd` // `Result::ok()`. This matches the behavior of GNU `dd`
// when given the command-line argument `of=/dev/null`. // when given the command-line argument `of=/dev/null`.
let i = seek.unwrap_or(0);
// The --seek and --oseek flags are additive.
let i = seek.unwrap_or(0) + oseek.unwrap_or(0);
if !cflags.notrunc { if !cflags.notrunc {
dst.set_len(i).ok(); dst.set_len(i).ok();
} }
@ -730,11 +746,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::INFILE) Arg::new(options::INFILE)
.long(options::INFILE) .long(options::INFILE)
@ -807,6 +823,24 @@ pub fn uu_app<'a>() -> App<'a> {
.value_name("N") .value_name("N")
.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::new(options::ISEEK)
.long(options::ISEEK)
.overrides_with(options::ISEEK)
.takes_value(true)
.require_equals(true)
.value_name("N")
.help("(alternatively iseek=N) seeks N obs-sized records into input before beginning copy/convert operations. See iflag=seek_bytes if seeking N bytes is preferred. Multiplier strings permitted.")
)
.arg(
Arg::new(options::OSEEK)
.long(options::OSEEK)
.overrides_with(options::OSEEK)
.takes_value(true)
.require_equals(true)
.value_name("N")
.help("(alternatively oseek=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(
Arg::new(options::COUNT) Arg::new(options::COUNT)
.long(options::COUNT) .long(options::COUNT)
@ -846,8 +880,8 @@ Printing performance stats is also triggered by the INFO signal (where supported
.long(options::CONV) .long(options::CONV)
.takes_value(true) .takes_value(true)
.multiple_occurrences(true) .multiple_occurrences(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_delimiter(true) .require_value_delimiter(true)
.multiple_values(true) .multiple_values(true)
.require_equals(true) .require_equals(true)
.value_name("CONV") .value_name("CONV")
@ -887,8 +921,8 @@ Conversion Flags:
.long(options::IFLAG) .long(options::IFLAG)
.takes_value(true) .takes_value(true)
.multiple_occurrences(true) .multiple_occurrences(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_delimiter(true) .require_value_delimiter(true)
.multiple_values(true) .multiple_values(true)
.require_equals(true) .require_equals(true)
.value_name("FLAG") .value_name("FLAG")
@ -917,8 +951,8 @@ General-Flags
.long(options::OFLAG) .long(options::OFLAG)
.takes_value(true) .takes_value(true)
.multiple_occurrences(true) .multiple_occurrences(true)
.use_delimiter(true) .use_value_delimiter(true)
.require_delimiter(true) .require_value_delimiter(true)
.multiple_values(true) .multiple_values(true)
.require_equals(true) .require_equals(true)
.value_name("FLAG") .value_name("FLAG")

View file

@ -4,7 +4,7 @@
// //
// 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.
// spell-checker:ignore ctty, ctable, iconvflags, oconvflags parseargs // spell-checker:ignore ctty, ctable, iseek, oseek, iconvflags, oconvflags parseargs
#[cfg(test)] #[cfg(test)]
mod unit_tests; mod unit_tests;
@ -100,16 +100,16 @@ impl std::fmt::Display for ParseError {
Self::StatusLevelNotRecognized(arg) => { Self::StatusLevelNotRecognized(arg) => {
write!(f, "status=LEVEL not recognized -> {}", arg) write!(f, "status=LEVEL not recognized -> {}", arg)
} }
ParseError::BsOutOfRange => { Self::BsOutOfRange => {
write!(f, "bs=N cannot fit into memory") write!(f, "bs=N cannot fit into memory")
} }
ParseError::IbsOutOfRange => { Self::IbsOutOfRange => {
write!(f, "ibs=N cannot fit into memory") write!(f, "ibs=N cannot fit into memory")
} }
ParseError::ObsOutOfRange => { Self::ObsOutOfRange => {
write!(f, "obs=N cannot fit into memory") write!(f, "obs=N cannot fit into memory")
} }
ParseError::CbsOutOfRange => { Self::CbsOutOfRange => {
write!(f, "cbs=N cannot fit into memory") write!(f, "cbs=N cannot fit into memory")
} }
Self::Unimplemented(arg) => { Self::Unimplemented(arg) => {
@ -740,15 +740,15 @@ pub fn parse_oflags(matches: &Matches) -> Result<OFlags, ParseError> {
Ok(oflags) Ok(oflags)
} }
/// Parse the amount of the input file to skip. pub fn parse_seek_skip_amt(
pub fn parse_skip_amt(
ibs: &usize, ibs: &usize,
iflags: &IFlags, bytes: bool,
matches: &Matches, matches: &Matches,
option: &str,
) -> Result<Option<u64>, ParseError> { ) -> Result<Option<u64>, ParseError> {
if let Some(amt) = matches.value_of(options::SKIP) { if let Some(amt) = matches.value_of(option) {
let n = parse_bytes_with_opt_multiplier(amt)?; let n = parse_bytes_with_opt_multiplier(amt)?;
if iflags.skip_bytes { if bytes {
Ok(Some(n)) Ok(Some(n))
} else { } else {
Ok(Some(*ibs as u64 * n)) Ok(Some(*ibs as u64 * n))
@ -758,24 +758,6 @@ pub fn parse_skip_amt(
} }
} }
/// Parse the amount of the output file to seek.
pub fn parse_seek_amt(
obs: &usize,
oflags: &OFlags,
matches: &Matches,
) -> Result<Option<u64>, ParseError> {
if let Some(amt) = matches.value_of(options::SEEK) {
let n = parse_bytes_with_opt_multiplier(amt)?;
if oflags.seek_bytes {
Ok(Some(n))
} else {
Ok(Some(*obs as u64 * n))
}
} else {
Ok(None)
}
}
/// Parse the value of count=N and the type of N implied by iflags /// Parse the value of count=N and the type of N implied by iflags
pub fn parse_count(iflags: &IFlags, matches: &Matches) -> Result<Option<CountType>, ParseError> { pub fn parse_count(iflags: &IFlags, matches: &Matches) -> Result<Option<CountType>, ParseError> {
if let Some(amt) = matches.value_of(options::COUNT) { if let Some(amt) = matches.value_of(options::COUNT) {

View file

@ -1,4 +1,4 @@
// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat // spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, iseek, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, oseek, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat
use super::*; use super::*;
@ -112,6 +112,8 @@ fn test_all_top_level_args_no_leading_dashes() {
String::from("count=2"), String::from("count=2"),
String::from("skip=2"), String::from("skip=2"),
String::from("seek=2"), String::from("seek=2"),
String::from("iseek=2"),
String::from("oseek=2"),
String::from("status=progress"), String::from("status=progress"),
String::from("conv=ascii,ucase"), String::from("conv=ascii,ucase"),
String::from("iflag=count_bytes,skip_bytes"), String::from("iflag=count_bytes,skip_bytes"),
@ -140,13 +142,25 @@ fn test_all_top_level_args_no_leading_dashes() {
); );
assert_eq!( assert_eq!(
200, 200,
parse_skip_amt(&100, &IFlags::default(), &matches) parse_seek_skip_amt(&100, IFlags::default().skip_bytes, &matches, options::SKIP)
.unwrap() .unwrap()
.unwrap() .unwrap()
); );
assert_eq!( assert_eq!(
200, 200,
parse_seek_amt(&100, &OFlags::default(), &matches) parse_seek_skip_amt(&100, OFlags::default().seek_bytes, &matches, options::SEEK)
.unwrap()
.unwrap()
);
assert_eq!(
200,
parse_seek_skip_amt(&100, IFlags::default().skip_bytes, &matches, options::ISEEK)
.unwrap()
.unwrap()
);
assert_eq!(
200,
parse_seek_skip_amt(&100, OFlags::default().seek_bytes, &matches, options::OSEEK)
.unwrap() .unwrap()
.unwrap() .unwrap()
); );
@ -197,6 +211,8 @@ fn test_all_top_level_args_with_leading_dashes() {
String::from("--count=2"), String::from("--count=2"),
String::from("--skip=2"), String::from("--skip=2"),
String::from("--seek=2"), String::from("--seek=2"),
String::from("--iseek=2"),
String::from("--oseek=2"),
String::from("--status=progress"), String::from("--status=progress"),
String::from("--conv=ascii,ucase"), String::from("--conv=ascii,ucase"),
String::from("--iflag=count_bytes,skip_bytes"), String::from("--iflag=count_bytes,skip_bytes"),
@ -225,13 +241,25 @@ fn test_all_top_level_args_with_leading_dashes() {
); );
assert_eq!( assert_eq!(
200, 200,
parse_skip_amt(&100, &IFlags::default(), &matches) parse_seek_skip_amt(&100, IFlags::default().skip_bytes, &matches, options::SKIP)
.unwrap() .unwrap()
.unwrap() .unwrap()
); );
assert_eq!( assert_eq!(
200, 200,
parse_seek_amt(&100, &OFlags::default(), &matches) parse_seek_skip_amt(&100, OFlags::default().seek_bytes, &matches, options::SEEK)
.unwrap()
.unwrap()
);
assert_eq!(
200,
parse_seek_skip_amt(&100, IFlags::default().skip_bytes, &matches, options::ISEEK)
.unwrap()
.unwrap()
);
assert_eq!(
200,
parse_seek_skip_amt(&100, OFlags::default().seek_bytes, &matches, options::OSEEK)
.unwrap() .unwrap()
.unwrap() .unwrap()
); );
@ -303,10 +331,10 @@ fn test_status_level_noxfer() {
fn test_multiple_flags_options() { fn test_multiple_flags_options() {
let args = vec![ let args = vec![
String::from("dd"), String::from("dd"),
String::from("--iflag=fullblock,directory"), String::from("--iflag=fullblock,count_bytes"),
String::from("--iflag=skip_bytes"), String::from("--iflag=skip_bytes"),
String::from("--oflag=direct"), String::from("--oflag=append"),
String::from("--oflag=dsync"), String::from("--oflag=seek_bytes"),
String::from("--conv=ascii,ucase"), String::from("--conv=ascii,ucase"),
String::from("--conv=unblock"), String::from("--conv=unblock"),
]; ];
@ -315,13 +343,13 @@ fn test_multiple_flags_options() {
// iflag // iflag
let iflags = parse_flag_list::<Flag>(options::IFLAG, &matches).unwrap(); let iflags = parse_flag_list::<Flag>(options::IFLAG, &matches).unwrap();
assert_eq!( assert_eq!(
vec![Flag::FullBlock, Flag::Directory, Flag::SkipBytes], vec![Flag::FullBlock, Flag::CountBytes, Flag::SkipBytes],
iflags iflags
); );
// oflag // oflag
let oflags = parse_flag_list::<Flag>(options::OFLAG, &matches).unwrap(); let oflags = parse_flag_list::<Flag>(options::OFLAG, &matches).unwrap();
assert_eq!(vec![Flag::Direct, Flag::Dsync], oflags); assert_eq!(vec![Flag::Append, Flag::SeekBytes], oflags);
// conv // conv
let conv = parse_flag_list::<ConvFlag>(options::CONV, &matches).unwrap(); let conv = parse_flag_list::<ConvFlag>(options::CONV, &matches).unwrap();
@ -349,6 +377,10 @@ fn test_override_multiple_options() {
String::from("--skip=2"), String::from("--skip=2"),
String::from("--seek=0"), String::from("--seek=0"),
String::from("--seek=2"), String::from("--seek=2"),
String::from("--iseek=0"),
String::from("--iseek=2"),
String::from("--oseek=0"),
String::from("--oseek=2"),
String::from("--status=none"), String::from("--status=none"),
String::from("--status=noxfer"), String::from("--status=noxfer"),
String::from("--count=512"), String::from("--count=512"),
@ -381,7 +413,7 @@ fn test_override_multiple_options() {
// skip // skip
assert_eq!( assert_eq!(
200, 200,
parse_skip_amt(&100, &IFlags::default(), &matches) parse_seek_skip_amt(&100, IFlags::default().skip_bytes, &matches, options::SKIP)
.unwrap() .unwrap()
.unwrap() .unwrap()
); );
@ -389,7 +421,23 @@ fn test_override_multiple_options() {
// seek // seek
assert_eq!( assert_eq!(
200, 200,
parse_seek_amt(&100, &OFlags::default(), &matches) parse_seek_skip_amt(&100, OFlags::default().seek_bytes, &matches, options::SEEK)
.unwrap()
.unwrap()
);
// iseek
assert_eq!(
200,
parse_seek_skip_amt(&100, IFlags::default().skip_bytes, &matches, options::ISEEK)
.unwrap()
.unwrap()
);
// oseek
assert_eq!(
200,
parse_seek_skip_amt(&100, OFlags::default().seek_bytes, &matches, options::OSEEK)
.unwrap() .unwrap()
.unwrap() .unwrap()
); );
@ -685,7 +733,7 @@ mod test_64bit_arch {
#[test] #[test]
#[should_panic] #[should_panic]
fn test_overflow_panic() { fn test_overflow_panic() {
let bs_str = format!("{}KiB", usize::MAX); let bs_str = format!("{}KiB", u64::MAX);
parse_bytes_with_opt_multiplier(&bs_str).unwrap(); parse_bytes_with_opt_multiplier(&bs_str).unwrap();
} }

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/df.rs" path = "src/df.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }

View file

@ -15,7 +15,7 @@ use uucore::error::{UResult, USimpleError};
use uucore::format_usage; use uucore::format_usage;
use uucore::fsext::{read_fs_list, MountInfo}; use uucore::fsext::{read_fs_list, MountInfo};
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use std::fmt; use std::fmt;
use std::path::Path; use std::path::Path;
@ -29,9 +29,9 @@ static ABOUT: &str = "Show information about the file system on which each FILE
or all file systems by default."; or all file systems by default.";
const USAGE: &str = "{} [OPTION]... [FILE]..."; const USAGE: &str = "{} [OPTION]... [FILE]...";
static OPT_HELP: &str = "help";
static OPT_ALL: &str = "all"; static OPT_ALL: &str = "all";
static OPT_BLOCKSIZE: &str = "blocksize"; static OPT_BLOCKSIZE: &str = "blocksize";
static OPT_DIRECT: &str = "direct";
static OPT_TOTAL: &str = "total"; static OPT_TOTAL: &str = "total";
static OPT_HUMAN_READABLE: &str = "human-readable"; static OPT_HUMAN_READABLE: &str = "human-readable";
static OPT_HUMAN_READABLE_2: &str = "human-readable-2"; static OPT_HUMAN_READABLE_2: &str = "human-readable-2";
@ -316,12 +316,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(
Arg::new(OPT_HELP)
.long(OPT_HELP)
.help("Print help information."),
)
.arg( .arg(
Arg::new(OPT_ALL) Arg::new(OPT_ALL)
.short('a') .short('a')
@ -338,11 +343,6 @@ pub fn uu_app<'a>() -> App<'a> {
'-BM' prints sizes in units of 1,048,576 bytes", '-BM' prints sizes in units of 1,048,576 bytes",
), ),
) )
.arg(
Arg::new(OPT_DIRECT)
.long("direct")
.help("show statistics for a file instead of mount point"),
)
.arg( .arg(
Arg::new(OPT_TOTAL) Arg::new(OPT_TOTAL)
.long("total") .long("total")
@ -385,7 +385,7 @@ pub fn uu_app<'a>() -> App<'a> {
Arg::new(OPT_OUTPUT) Arg::new(OPT_OUTPUT)
.long("output") .long("output")
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.possible_values(OUTPUT_FIELD_LIST) .possible_values(OUTPUT_FIELD_LIST)
.default_missing_values(&OUTPUT_FIELD_LIST) .default_missing_values(&OUTPUT_FIELD_LIST)
.default_values(&["source", "size", "used", "avail", "pcent", "target"]) .default_values(&["source", "size", "used", "avail", "pcent", "target"])
@ -428,7 +428,7 @@ pub fn uu_app<'a>() -> App<'a> {
.long("exclude-type") .long("exclude-type")
.allow_invalid_utf8(true) .allow_invalid_utf8(true)
.takes_value(true) .takes_value(true)
.use_delimiter(true) .use_value_delimiter(true)
.multiple_occurrences(true) .multiple_occurrences(true)
.help("limit listing to file systems not of type TYPE"), .help("limit listing to file systems not of type TYPE"),
) )

View file

@ -39,8 +39,8 @@ pub(crate) struct Row {
/// Number of used bytes. /// Number of used bytes.
bytes_used: u64, bytes_used: u64,
/// Number of free bytes. /// Number of available bytes.
bytes_free: u64, bytes_avail: u64,
/// Percentage of bytes that are used, given as a float between 0 and 1. /// Percentage of bytes that are used, given as a float between 0 and 1.
/// ///
@ -78,7 +78,7 @@ impl Row {
fs_mount: "-".into(), fs_mount: "-".into(),
bytes: 0, bytes: 0,
bytes_used: 0, bytes_used: 0,
bytes_free: 0, bytes_avail: 0,
bytes_usage: None, bytes_usage: None,
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
bytes_capacity: None, bytes_capacity: None,
@ -106,7 +106,7 @@ impl AddAssign for Row {
fs_mount: "-".into(), fs_mount: "-".into(),
bytes, bytes,
bytes_used, bytes_used,
bytes_free: self.bytes_free + rhs.bytes_free, bytes_avail: self.bytes_avail + rhs.bytes_avail,
bytes_usage: if bytes == 0 { bytes_usage: if bytes == 0 {
None None
} else { } else {
@ -139,7 +139,6 @@ impl From<Filesystem> for Row {
blocksize, blocksize,
blocks, blocks,
bfree, bfree,
#[cfg(target_os = "macos")]
bavail, bavail,
files, files,
ffree, ffree,
@ -151,7 +150,7 @@ impl From<Filesystem> for Row {
fs_mount: mount_dir, fs_mount: mount_dir,
bytes: blocksize * blocks, bytes: blocksize * blocks,
bytes_used: blocksize * (blocks - bfree), bytes_used: blocksize * (blocks - bfree),
bytes_free: blocksize * bfree, bytes_avail: blocksize * bavail,
bytes_usage: if blocks == 0 { bytes_usage: if blocks == 0 {
None None
} else { } else {
@ -236,7 +235,7 @@ impl fmt::Display for DisplayRow<'_> {
Column::Source => write!(f, "{0: <16} ", self.row.fs_device)?, Column::Source => write!(f, "{0: <16} ", self.row.fs_device)?,
Column::Size => write!(f, "{0: >12} ", self.scaled(self.row.bytes)?)?, Column::Size => write!(f, "{0: >12} ", self.scaled(self.row.bytes)?)?,
Column::Used => write!(f, "{0: >12} ", self.scaled(self.row.bytes_used)?)?, Column::Used => write!(f, "{0: >12} ", self.scaled(self.row.bytes_used)?)?,
Column::Avail => write!(f, "{0: >12} ", self.scaled(self.row.bytes_free)?)?, Column::Avail => write!(f, "{0: >12} ", self.scaled(self.row.bytes_avail)?)?,
Column::Pcent => { Column::Pcent => {
write!(f, "{0: >5} ", DisplayRow::percentage(self.row.bytes_usage))?; write!(f, "{0: >5} ", DisplayRow::percentage(self.row.bytes_usage))?;
} }
@ -413,7 +412,7 @@ mod tests {
bytes: 100, bytes: 100,
bytes_used: 25, bytes_used: 25,
bytes_free: 75, bytes_avail: 75,
bytes_usage: Some(0.25), bytes_usage: Some(0.25),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@ -444,7 +443,7 @@ mod tests {
bytes: 100, bytes: 100,
bytes_used: 25, bytes_used: 25,
bytes_free: 75, bytes_avail: 75,
bytes_usage: Some(0.25), bytes_usage: Some(0.25),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@ -475,7 +474,7 @@ mod tests {
bytes: 100, bytes: 100,
bytes_used: 25, bytes_used: 25,
bytes_free: 75, bytes_avail: 75,
bytes_usage: Some(0.25), bytes_usage: Some(0.25),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@ -506,7 +505,7 @@ mod tests {
bytes: 4000, bytes: 4000,
bytes_used: 1000, bytes_used: 1000,
bytes_free: 3000, bytes_avail: 3000,
bytes_usage: Some(0.25), bytes_usage: Some(0.25),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@ -537,7 +536,7 @@ mod tests {
bytes: 4096, bytes: 4096,
bytes_used: 1024, bytes_used: 1024,
bytes_free: 3072, bytes_avail: 3072,
bytes_usage: Some(0.25), bytes_usage: Some(0.25),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@ -567,7 +566,7 @@ mod tests {
bytes: 100, bytes: 100,
bytes_used: 25, bytes_used: 25,
bytes_free: 75, bytes_avail: 75,
bytes_usage: Some(0.251), bytes_usage: Some(0.251),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/dircolors.rs" path = "src/dircolors.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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" }

View file

@ -13,7 +13,7 @@ use std::env;
use std::fs::File; use std::fs::File;
use std::io::{BufRead, BufReader}; use std::io::{BufRead, BufReader};
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::error::{UResult, USimpleError, UUsageError};
@ -154,13 +154,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BOURNE_SHELL) Arg::new(options::BOURNE_SHELL)
.long("sh") .long("sh")

View file

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

View file

@ -5,7 +5,7 @@
// 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::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::path::Path; use std::path::Path;
use uucore::display::print_verbatim; use uucore::display::print_verbatim;
use uucore::error::{UResult, UUsageError}; use uucore::error::{UResult, UUsageError};
@ -76,12 +76,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.about(ABOUT) .about(ABOUT)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::ZERO) Arg::new(options::ZERO)
.long(options::ZERO) .long(options::ZERO)

View file

@ -16,7 +16,7 @@ path = "src/du.rs"
[dependencies] [dependencies]
chrono = "^0.4.11" chrono = "^0.4.11"
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[target.'cfg(target_os = "windows")'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]

View file

@ -10,7 +10,7 @@ extern crate uucore;
use chrono::prelude::DateTime; use chrono::prelude::DateTime;
use chrono::Local; use chrono::Local;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use std::collections::HashSet; use std::collections::HashSet;
use std::env; use std::env;
use std::fs; use std::fs;
@ -47,6 +47,7 @@ use winapi::um::winbase::GetFileInformationByHandleEx;
use winapi::um::winnt::{FILE_ID_128, ULONGLONG}; use winapi::um::winnt::{FILE_ID_128, ULONGLONG};
mod options { mod options {
pub const HELP: &str = "help";
pub const NULL: &str = "0"; pub const NULL: &str = "0";
pub const ALL: &str = "all"; pub const ALL: &str = "all";
pub const APPARENT_SIZE: &str = "apparent-size"; pub const APPARENT_SIZE: &str = "apparent-size";
@ -617,13 +618,18 @@ fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult<Option<u
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information.")
)
.arg( .arg(
Arg::new(options::ALL) Arg::new(options::ALL)
.short('a') .short('a')

View file

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

View file

@ -6,7 +6,7 @@
// 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::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::io::{self, Write}; use std::io::{self, Write};
use std::iter::Peekable; use std::iter::Peekable;
use std::str::Chars; use std::str::Chars;
@ -126,15 +126,15 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.map_err_context(|| "could not write to stdout".to_string()) .map_err_context(|| "could not write to stdout".to_string())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::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(AppSettings::TrailingVarArg) .trailing_var_arg(true)
.setting(AppSettings::AllowHyphenValues) .allow_hyphen_values(true)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.after_help(AFTER_HELP) .after_help(AFTER_HELP)

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/env.rs" path = "src/env.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
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" }

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

@ -16,13 +16,13 @@ extern crate clap;
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{App, AppSettings, Arg}; use clap::{Arg, Command};
use ini::Ini; use ini::Ini;
use std::borrow::Cow; use std::borrow::Cow;
use std::env; use std::env;
use std::io::{self, Write}; use std::io::{self, Write};
use std::iter::Iterator; use std::iter::Iterator;
use std::process::Command; use std::process;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::error::{UResult, USimpleError, UUsageError};
use uucore::format_usage; use uucore::format_usage;
@ -121,15 +121,15 @@ fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b
(progname, &args[..]) (progname, &args[..])
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(crate_name!()) Command::new(crate_name!())
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.after_help(AFTER_HELP) .after_help(AFTER_HELP)
.setting(AppSettings::AllowExternalSubcommands) .allow_external_subcommands(true)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(Arg::new("ignore-environment") .arg(Arg::new("ignore-environment")
.short('i') .short('i')
.long("ignore-environment") .long("ignore-environment")
@ -307,7 +307,7 @@ fn run_env(args: impl uucore::Args) -> UResult<()> {
* standard library contains many checks and fail-safes to ensure the process ends up being * standard library contains many checks and fail-safes to ensure the process ends up being
* created. This is much simpler than dealing with the hassles of calling execvp directly. * created. This is much simpler than dealing with the hassles of calling execvp directly.
*/ */
match Command::new(&*prog).args(args).status() { match process::Command::new(&*prog).args(args).status() {
Ok(exit) if !exit.success() => return Err(exit.code().unwrap().into()), Ok(exit) if !exit.success() => return Err(exit.code().unwrap().into()),
Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127.into()), Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127.into()),
Err(_) => return Err(126.into()), Err(_) => return Err(126.into()),

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/expand.rs" path = "src/expand.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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" }

View file

@ -12,7 +12,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use std::fs::File; use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::str::from_utf8; use std::str::from_utf8;
@ -176,13 +176,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
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<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.after_help(LONG_HELP) .after_help(LONG_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::INITIAL) Arg::new(options::INITIAL)
.long(options::INITIAL) .long(options::INITIAL)

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/expr.rs" path = "src/expr.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
num-bigint = "0.4.0" num-bigint = "0.4.0"
num-traits = "0.2.14" num-traits = "0.2.14"
onig = { version = "~6.3", default-features = false } onig = { version = "~6.3", default-features = false }

View file

@ -5,7 +5,7 @@
//* 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::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use uucore::error::{UResult, USimpleError}; use uucore::error::{UResult, USimpleError};
use uucore::InvalidEncodingHandling; use uucore::InvalidEncodingHandling;
@ -19,12 +19,12 @@ static USAGE: &str = r#"
expr [EXPRESSION] expr [EXPRESSION]
expr [OPTIONS]"#; expr [OPTIONS]"#;
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(USAGE) .override_usage(USAGE)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(VERSION) Arg::new(VERSION)
.long(VERSION) .long(VERSION)

View file

@ -65,7 +65,7 @@ impl Token {
} }
} }
fn is_a_close_paren(&self) -> bool { fn is_a_close_paren(&self) -> bool {
matches!(*self, Token::ParClose) matches!(*self, Self::ParClose)
} }
} }

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 = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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.8", features = ["small_rng"] } rand = { version = "0.8", features = ["small_rng"] }

View file

@ -14,7 +14,7 @@ use std::fmt::Write as FmtWrite;
use std::io::{self, stdin, stdout, BufRead, Write}; use std::io::{self, stdin, stdout, BufRead, Write};
mod factor; mod factor;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
pub use factor::*; pub use factor::*;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::UResult; use uucore::error::UResult;
@ -77,10 +77,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(Arg::new(options::NUMBER).multiple_occurrences(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 = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -4,7 +4,7 @@
// * // *
// * 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, AppSettings, Arg}; use clap::{Arg, Command};
use std::io::Write; use std::io::Write;
use uucore::error::{set_exit_code, UResult}; use uucore::error::{set_exit_code, UResult};
@ -18,7 +18,7 @@ the program will also return `1`.
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut app = uu_app(); let mut command = uu_app();
// Mirror GNU options, always return `1`. In particular even the 'successful' cases of no-op, // Mirror GNU options, always return `1`. In particular even the 'successful' cases of no-op,
// and the interrupted display of help and version should return `1`. Also, we return Ok in all // and the interrupted display of help and version should return `1`. Also, we return Ok in all
@ -26,11 +26,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// and unwind through the standard library allocation handling machinery. // and unwind through the standard library allocation handling machinery.
set_exit_code(1); set_exit_code(1);
if let Ok(matches) = app.try_get_matches_from_mut(args) { if let Ok(matches) = command.try_get_matches_from_mut(args) {
let error = if matches.index_of("help").is_some() { let error = if matches.index_of("help").is_some() {
app.print_long_help() command.print_long_help()
} else if matches.index_of("version").is_some() { } else if matches.index_of("version").is_some() {
writeln!(std::io::stdout(), "{}", app.render_version()) writeln!(std::io::stdout(), "{}", command.render_version())
} else { } else {
Ok(()) Ok(())
}; };
@ -45,12 +45,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(clap::crate_version!()) .version(clap::crate_version!())
.about(ABOUT) .about(ABOUT)
// We provide our own help and version options, to ensure maximum compatibility with GNU. // We provide our own help and version options, to ensure maximum compatibility with GNU.
.setting(AppSettings::DisableHelpFlag | AppSettings::DisableVersionFlag) .disable_help_flag(true)
.disable_version_flag(true)
.arg( .arg(
Arg::new("help") Arg::new("help")
.long("help") .long("help")

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/fmt.rs" path = "src/fmt.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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" }

View file

@ -10,7 +10,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::cmp; use std::cmp;
use std::fs::File; use std::fs::File;
use std::io::{stdin, stdout, Write}; use std::io::{stdin, stdout, Write};
@ -218,12 +218,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_CROWN_MARGIN) Arg::new(OPT_CROWN_MARGIN)
.short('c') .short('c')

View file

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

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDOs) ncount routput // spell-checker:ignore (ToDOs) ncount routput
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::fs::File; use std::fs::File;
use std::io::{stdin, BufRead, BufReader, Read}; use std::io::{stdin, BufRead, BufReader, Read};
use std::path::Path; use std::path::Path;
@ -63,13 +63,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
fold(&files, bytes, spaces, width) fold(&files, bytes, spaces, width)
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about(SUMMARY) .about(SUMMARY)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES) Arg::new(options::BYTES)
.long(options::BYTES) .long(options::BYTES)

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/groups.rs" path = "src/groups.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
[[bin]] [[bin]]

View file

@ -26,7 +26,7 @@ use uucore::{
format_usage, format_usage,
}; };
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
mod options { mod options {
pub const USERS: &str = "USERNAME"; pub const USERS: &str = "USERNAME";
@ -50,9 +50,9 @@ impl UError for GroupsError {}
impl Display for GroupsError { impl Display for GroupsError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self { match self {
GroupsError::GetGroupsFailed => write!(f, "failed to fetch groups"), Self::GetGroupsFailed => write!(f, "failed to fetch groups"),
GroupsError::GroupNotFound(gid) => write!(f, "cannot find name for group ID {}", gid), Self::GroupNotFound(gid) => write!(f, "cannot find name for group ID {}", gid),
GroupsError::UserNotFound(user) => write!(f, "{}: no such user", user.quote()), Self::UserNotFound(user) => write!(f, "{}: no such user", user.quote()),
} }
} }
} }
@ -102,12 +102,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::USERS) Arg::new(options::USERS)
.multiple_occurrences(true) .multiple_occurrences(true)

View file

@ -16,7 +16,7 @@ path = "src/hashsum.rs"
[dependencies] [dependencies]
digest = "0.10.1" digest = "0.10.1"
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
hex = "0.4.3" hex = "0.4.3"
memchr = "2" memchr = "2"
md-5 = "0.10.1" md-5 = "0.10.1"

View file

@ -274,7 +274,7 @@ mod tests {
use crate::digest::DigestWriter; use crate::digest::DigestWriter;
// Writing "\r" in one call to `write()`, and then "\n" in another. // Writing "\r" in one call to `write()`, and then "\n" in another.
let mut digest = Box::new(md5::Context::new()) as Box<dyn Digest>; let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
let mut writer_crlf = DigestWriter::new(&mut digest, false); let mut writer_crlf = DigestWriter::new(&mut digest, false);
writer_crlf.write_all(&[b'\r']).unwrap(); writer_crlf.write_all(&[b'\r']).unwrap();
writer_crlf.write_all(&[b'\n']).unwrap(); writer_crlf.write_all(&[b'\n']).unwrap();
@ -282,7 +282,7 @@ mod tests {
let result_crlf = digest.result_str(); let result_crlf = digest.result_str();
// We expect "\r\n" to be replaced with "\n" in text mode on Windows. // We expect "\r\n" to be replaced with "\n" in text mode on Windows.
let mut digest = Box::new(md5::Context::new()) as Box<dyn Digest>; let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
let mut writer_lf = DigestWriter::new(&mut digest, false); let mut writer_lf = DigestWriter::new(&mut digest, false);
writer_lf.write_all(&[b'\n']).unwrap(); writer_lf.write_all(&[b'\n']).unwrap();
writer_lf.finalize(); writer_lf.finalize();

View file

@ -20,7 +20,7 @@ mod digest;
use self::digest::Digest; use self::digest::Digest;
use self::digest::DigestWriter; use self::digest::DigestWriter;
use clap::{App, AppSettings, Arg, ArgMatches}; use clap::{Arg, ArgMatches, Command};
use hex::encode; use hex::encode;
use md5::Md5; use md5::Md5;
use regex::Regex; use regex::Regex;
@ -297,13 +297,13 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
// Default binary in Windows, text mode otherwise // Default binary in Windows, text mode otherwise
let binary_flag_default = cfg!(windows); let binary_flag_default = cfg!(windows);
let app = uu_app(&binary_name); let command = uu_app(&binary_name);
// FIXME: this should use try_get_matches_from() 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.
let matches = app.get_matches_from(args); let matches = command.get_matches_from(args);
let (name, algo, bits) = detect_algo(&binary_name, &matches); let (name, algo, bits) = detect_algo(&binary_name, &matches);
@ -340,7 +340,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app_common<'a>() -> App<'a> { pub fn uu_app_common<'a>() -> Command<'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))]
@ -349,10 +349,10 @@ pub fn uu_app_common<'a>() -> App<'a> {
const TEXT_HELP: &str = "read in text mode"; const TEXT_HELP: &str = "read in text mode";
#[cfg(not(windows))] #[cfg(not(windows))]
const TEXT_HELP: &str = "read in text mode (default)"; const TEXT_HELP: &str = "read in text mode (default)";
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about("Compute and check message digests.") .about("Compute and check message digests.")
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new("binary") Arg::new("binary")
.short('b') .short('b')
@ -419,8 +419,8 @@ pub fn uu_app_common<'a>() -> App<'a> {
) )
} }
pub fn uu_app_custom<'a>() -> App<'a> { pub fn uu_app_custom<'a>() -> Command<'a> {
let mut app = uu_app_common(); let mut command = uu_app_common();
let algorithms = &[ let algorithms = &[
("md5", "work with MD5"), ("md5", "work with MD5"),
("sha1", "work with SHA1"), ("sha1", "work with SHA1"),
@ -446,14 +446,14 @@ pub fn uu_app_custom<'a>() -> App<'a> {
]; ];
for (name, desc) in algorithms { for (name, desc) in algorithms {
app = app.arg(Arg::new(*name).long(name).help(*desc)); command = command.arg(Arg::new(*name).long(name).help(*desc));
} }
app command
} }
// 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<'a>(binary_name: &str) -> App<'a> { fn uu_app<'a>(binary_name: &str) -> Command<'a> {
if !is_custom_binary(binary_name) { if !is_custom_binary(binary_name) {
uu_app_custom() uu_app_custom()
} else { } else {
@ -473,8 +473,8 @@ impl UError for HashsumError {}
impl std::fmt::Display for HashsumError { impl std::fmt::Display for HashsumError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self { match self {
HashsumError::InvalidRegex => write!(f, "invalid regular expression"), Self::InvalidRegex => write!(f, "invalid regular expression"),
HashsumError::InvalidFormat => Ok(()), Self::InvalidFormat => Ok(()),
} }
} }
} }

View file

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

View file

@ -5,7 +5,7 @@
// spell-checker:ignore (vars) zlines BUFWRITER seekable // spell-checker:ignore (vars) zlines BUFWRITER seekable
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use std::convert::{TryFrom, TryInto}; use std::convert::{TryFrom, TryInto};
use std::ffi::OsString; use std::ffi::OsString;
use std::io::{self, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write}; use std::io::{self, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write};
@ -41,12 +41,12 @@ mod take;
use take::take_all_but; use take::take_all_but;
use take::take_lines; use take::take_lines;
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::BYTES_NAME) Arg::new(options::BYTES_NAME)
.short('c') .short('c')

View file

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

View file

@ -7,7 +7,7 @@
// spell-checker:ignore (ToDO) gethostid // spell-checker:ignore (ToDO) gethostid
use clap::{crate_version, App, AppSettings}; use clap::{crate_version, Command};
use libc::c_long; use libc::c_long;
use uucore::{error::UResult, format_usage}; use uucore::{error::UResult, format_usage};
@ -26,12 +26,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(SUMMARY) .about(SUMMARY)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
} }
fn hostid() { fn hostid() {

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/hostname.rs" path = "src/hostname.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
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"] }
winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] }

View file

@ -11,7 +11,7 @@ use std::collections::hash_set::HashSet;
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
use std::str; use std::str;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use uucore::{ use uucore::{
error::{FromIo, UResult}, error::{FromIo, UResult},
@ -71,12 +71,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(OPT_DOMAIN) Arg::new(OPT_DOMAIN)
.short('d') .short('d')

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/id.rs" path = "src/id.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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"] }
selinux = { version="0.2", optional = true } selinux = { version="0.2", optional = true }

View file

@ -39,7 +39,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::ffi::CStr; use std::ffi::CStr;
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::entries::{self, Group, Locate, Passwd}; use uucore::entries::{self, Group, Locate, Passwd};
@ -341,12 +341,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::OPT_AUDIT) Arg::new(options::OPT_AUDIT)
.short('A') .short('A')

View file

@ -18,7 +18,7 @@ edition = "2018"
path = "src/install.rs" path = "src/install.rs"
[dependencies] [dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", 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

@ -12,7 +12,7 @@ mod mode;
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use clap::{crate_version, Arg, ArgMatches, Command};
use file_diff::diff; use file_diff::diff;
use filetime::{set_file_times, FileTime}; use filetime::{set_file_times, FileTime};
use uucore::backup_control::{self, BackupMode}; use uucore::backup_control::{self, BackupMode};
@ -30,7 +30,7 @@ use std::fs;
use std::fs::File; use std::fs::File;
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::Command; use std::process;
const DEFAULT_MODE: u32 = 0o755; const DEFAULT_MODE: u32 = 0o755;
const DEFAULT_STRIP_PROGRAM: &str = "strip"; const DEFAULT_STRIP_PROGRAM: &str = "strip";
@ -188,12 +188,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
backup_control::arguments::backup() backup_control::arguments::backup()
) )
@ -585,7 +585,7 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> UResult<()> {
} }
if b.strip && cfg!(not(windows)) { if b.strip && cfg!(not(windows)) {
match Command::new(&b.strip_program).arg(to).output() { match process::Command::new(&b.strip_program).arg(to).output() {
Ok(o) => { Ok(o) => {
if !o.status.success() { if !o.status.success() {
return Err(InstallError::StripProgramFailed( return Err(InstallError::StripProgramFailed(

View file

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

View file

@ -10,7 +10,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use memchr::{memchr3_iter, memchr_iter}; use memchr::{memchr3_iter, memchr_iter};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::convert::From; use std::convert::From;
@ -697,8 +697,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(NAME) Command::new(NAME)
.version(crate_version!()) .version(crate_version!())
.about( .about(
"For each pair of input lines with identical join fields, write a line to "For each pair of input lines with identical join fields, write a line to
@ -706,7 +706,7 @@ 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.",
) )
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new("a") Arg::new("a")
.short('a') .short('a')

View file

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

View file

@ -10,7 +10,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use libc::{c_int, pid_t}; use libc::{c_int, pid_t};
use std::io::Error; use std::io::Error;
use uucore::display::Quotable; use uucore::display::Quotable;
@ -78,12 +78,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
} }
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::LIST) Arg::new(options::LIST)
.short('l') .short('l')

View file

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

View file

@ -4,7 +4,7 @@
// * // *
// * 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::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use std::fs::hard_link; use std::fs::hard_link;
use std::path::Path; use std::path::Path;
use uucore::display::Quotable; use uucore::display::Quotable;
@ -33,12 +33,12 @@ 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<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg( .arg(
Arg::new(options::FILES) Arg::new(options::FILES)
.hide(true) .hide(true)

View file

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

View file

@ -10,7 +10,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use uucore::display::Quotable; use uucore::display::Quotable;
use uucore::error::{UError, UResult}; use uucore::error::{UError, UResult};
use uucore::format_usage; use uucore::format_usage;
@ -173,12 +173,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
exec(&paths[..], &settings) exec(&paths[..], &settings)
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.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(

View file

@ -15,8 +15,8 @@ edition = "2018"
path = "src/logname.rs" path = "src/logname.rs"
[dependencies] [dependencies]
libc = "0.2.42" libc = "0.2.121"
clap = { version = "3.0", features = ["wrap_help", "cargo"] } clap = { version = "3.1", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" } uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -12,7 +12,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, App, AppSettings}; use clap::{crate_version, Command};
use std::ffi::CStr; use std::ffi::CStr;
use uucore::error::UResult; use uucore::error::UResult;
use uucore::InvalidEncodingHandling; use uucore::InvalidEncodingHandling;
@ -51,10 +51,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.override_usage(uucore::execution_phrase()) .override_usage(uucore::execution_phrase())
.about(SUMMARY) .about(SUMMARY)
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
} }

View file

@ -16,7 +16,7 @@ path = "src/ls.rs"
[dependencies] [dependencies]
chrono = "0.4.19" chrono = "0.4.19"
clap = { version = "3.0", features = ["wrap_help", "cargo", "env"] } clap = { version = "3.1", 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

@ -15,7 +15,7 @@ extern crate lazy_static;
mod quoting_style; mod quoting_style;
use clap::{crate_version, App, AppSettings, Arg}; use clap::{crate_version, Arg, Command};
use glob::Pattern; use glob::Pattern;
use lscolors::LsColors; use lscolors::LsColors;
use number_prefix::NumberPrefix; use number_prefix::NumberPrefix;
@ -116,6 +116,7 @@ pub mod options {
pub static DIR_ARGS: &str = "dereference-command-line-symlink-to-dir"; pub static DIR_ARGS: &str = "dereference-command-line-symlink-to-dir";
} }
pub static HELP: &str = "help";
pub static QUOTING_STYLE: &str = "quoting-style"; pub static QUOTING_STYLE: &str = "quoting-style";
pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars"; pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars";
pub static SHOW_CONTROL_CHARS: &str = "show-control-chars"; pub static SHOW_CONTROL_CHARS: &str = "show-control-chars";
@ -782,9 +783,9 @@ impl Config {
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let app = uu_app(); let command = uu_app();
let matches = app.get_matches_from(args); let matches = command.get_matches_from(args);
let config = Config::from(&matches)?; let config = Config::from(&matches)?;
@ -796,8 +797,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
list(locs, &config) list(locs, &config)
} }
pub fn uu_app<'a>() -> App<'a> { pub fn uu_app<'a>() -> Command<'a> {
App::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.about( .about(
@ -805,7 +806,12 @@ pub fn uu_app<'a>() -> App<'a> {
the command line, expect that it will ignore files and directories \ the command line, expect that it will ignore files and directories \
whose names start with '.'.", whose names start with '.'.",
) )
.setting(AppSettings::InferLongArgs) .infer_long_args(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information.")
)
// Format arguments // Format arguments
.arg( .arg(
Arg::new(options::FORMAT) Arg::new(options::FORMAT)
@ -1196,12 +1202,18 @@ pub fn uu_app<'a>() -> App<'a> {
Arg::new(options::files::ALL) Arg::new(options::files::ALL)
.short('a') .short('a')
.long(options::files::ALL) .long(options::files::ALL)
// Overrides -A (as the order matters)
.overrides_with(options::files::ALMOST_ALL)
.multiple_occurrences(true)
.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::new(options::files::ALMOST_ALL) Arg::new(options::files::ALMOST_ALL)
.short('A') .short('A')
.long(options::files::ALMOST_ALL) .long(options::files::ALMOST_ALL)
// Overrides -a (as the order matters)
.overrides_with(options::files::ALL)
.multiple_occurrences(true)
.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 '.', \
only ignore '.' and '..'.", only ignore '.' and '..'.",

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