1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +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" path = "src/realpath.rs"
[dependencies] [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 = { version=">=0.0.10", package="uucore", path="../../uucore", features=["fs"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } 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<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage(); let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args); let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
/* the list of files */ /* the list of files */
@ -74,44 +74,44 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(OPT_QUIET) Arg::new(OPT_QUIET)
.short("q") .short('q')
.long(OPT_QUIET) .long(OPT_QUIET)
.help("Do not print warnings for invalid paths"), .help("Do not print warnings for invalid paths"),
) )
.arg( .arg(
Arg::with_name(OPT_STRIP) Arg::new(OPT_STRIP)
.short("s") .short('s')
.long(OPT_STRIP) .long(OPT_STRIP)
.help("Only strip '.' and '..' components, but don't resolve symbolic links"), .help("Only strip '.' and '..' components, but don't resolve symbolic links"),
) )
.arg( .arg(
Arg::with_name(OPT_ZERO) Arg::new(OPT_ZERO)
.short("z") .short('z')
.long(OPT_ZERO) .long(OPT_ZERO)
.help("Separate output filenames with \\0 rather than newline"), .help("Separate output filenames with \\0 rather than newline"),
) )
.arg( .arg(
Arg::with_name(OPT_LOGICAL) Arg::new(OPT_LOGICAL)
.short("L") .short('L')
.long(OPT_LOGICAL) .long(OPT_LOGICAL)
.help("resolve '..' components before symlinks"), .help("resolve '..' components before symlinks"),
) )
.arg( .arg(
Arg::with_name(OPT_PHYSICAL) Arg::new(OPT_PHYSICAL)
.short("P") .short('P')
.long(OPT_PHYSICAL) .long(OPT_PHYSICAL)
.overrides_with_all(&[OPT_STRIP, OPT_LOGICAL]) .overrides_with_all(&[OPT_STRIP, OPT_LOGICAL])
.help("resolve symlinks as encountered (default)"), .help("resolve symlinks as encountered (default)"),
) )
.arg( .arg(
Arg::with_name(OPT_CANONICALIZE_EXISTING) Arg::new(OPT_CANONICALIZE_EXISTING)
.short("e") .short('e')
.long(OPT_CANONICALIZE_EXISTING) .long(OPT_CANONICALIZE_EXISTING)
.help( .help(
"canonicalize by following every symlink in every component of the \ "canonicalize by following every symlink in every component of the \
@ -119,8 +119,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(OPT_CANONICALIZE_MISSING) Arg::new(OPT_CANONICALIZE_MISSING)
.short("m") .short('m')
.long(OPT_CANONICALIZE_MISSING) .long(OPT_CANONICALIZE_MISSING)
.help( .help(
"canonicalize by following every symlink in every component of the \ "canonicalize by following every symlink in every component of the \
@ -128,8 +128,8 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
.arg( .arg(
Arg::with_name(ARG_FILES) Arg::new(ARG_FILES)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.min_values(1), .min_values(1),