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

realpath: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:40:08 +01:00
parent d8f2be2f3b
commit edafc468ed
2 changed files with 19 additions and 19 deletions

View file

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

View file

@ -41,7 +41,7 @@ fn usage() -> String {
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
/* the list of files */
@ -74,44 +74,44 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.arg(
Arg::with_name(OPT_QUIET)
.short("q")
Arg::new(OPT_QUIET)
.short('q')
.long(OPT_QUIET)
.help("Do not print warnings for invalid paths"),
)
.arg(
Arg::with_name(OPT_STRIP)
.short("s")
Arg::new(OPT_STRIP)
.short('s')
.long(OPT_STRIP)
.help("Only strip '.' and '..' components, but don't resolve symbolic links"),
)
.arg(
Arg::with_name(OPT_ZERO)
.short("z")
Arg::new(OPT_ZERO)
.short('z')
.long(OPT_ZERO)
.help("Separate output filenames with \\0 rather than newline"),
)
.arg(
Arg::with_name(OPT_LOGICAL)
.short("L")
Arg::new(OPT_LOGICAL)
.short('L')
.long(OPT_LOGICAL)
.help("resolve '..' components before symlinks"),
)
.arg(
Arg::with_name(OPT_PHYSICAL)
.short("P")
Arg::new(OPT_PHYSICAL)
.short('P')
.long(OPT_PHYSICAL)
.overrides_with_all(&[OPT_STRIP, OPT_LOGICAL])
.help("resolve symlinks as encountered (default)"),
)
.arg(
Arg::with_name(OPT_CANONICALIZE_EXISTING)
.short("e")
Arg::new(OPT_CANONICALIZE_EXISTING)
.short('e')
.long(OPT_CANONICALIZE_EXISTING)
.help(
"canonicalize by following every symlink in every component of the \
@ -119,8 +119,8 @@ pub fn uu_app() -> App<'static, 'static> {
),
)
.arg(
Arg::with_name(OPT_CANONICALIZE_MISSING)
.short("m")
Arg::new(OPT_CANONICALIZE_MISSING)
.short('m')
.long(OPT_CANONICALIZE_MISSING)
.help(
"canonicalize by following every symlink in every component of the \
@ -128,8 +128,8 @@ pub fn uu_app() -> App<'static, 'static> {
),
)
.arg(
Arg::with_name(ARG_FILES)
.multiple(true)
Arg::new(ARG_FILES)
.multiple_occurrences(true)
.takes_value(true)
.required(true)
.min_values(1),