mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
readlink: clap 3
This commit is contained in:
parent
24dc4d9037
commit
d8f2be2f3b
2 changed files with 24 additions and 20 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
|||
path = "src/readlink.rs"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "2.33", features = ["wrap_help"] }
|
||||
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||
libc = "0.2.42"
|
||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["fs"] }
|
||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||
|
|
|
@ -37,7 +37,7 @@ fn usage() -> String {
|
|||
#[uucore_procs::gen_uumain]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let usage = usage();
|
||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
||||
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
|
||||
|
||||
let mut no_newline = matches.is_present(OPT_NO_NEWLINE);
|
||||
let use_zero = matches.is_present(OPT_ZERO);
|
||||
|
@ -98,13 +98,13 @@ 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_CANONICALIZE)
|
||||
.short("f")
|
||||
Arg::new(OPT_CANONICALIZE)
|
||||
.short('f')
|
||||
.long(OPT_CANONICALIZE)
|
||||
.help(
|
||||
"canonicalize by following every symlink in every component of the \
|
||||
|
@ -112,8 +112,8 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(OPT_CANONICALIZE_EXISTING)
|
||||
.short("e")
|
||||
Arg::new(OPT_CANONICALIZE_EXISTING)
|
||||
.short('e')
|
||||
.long("canonicalize-existing")
|
||||
.help(
|
||||
"canonicalize by following every symlink in every component of the \
|
||||
|
@ -121,8 +121,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 \
|
||||
|
@ -130,36 +130,40 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(OPT_NO_NEWLINE)
|
||||
.short("n")
|
||||
Arg::new(OPT_NO_NEWLINE)
|
||||
.short('n')
|
||||
.long(OPT_NO_NEWLINE)
|
||||
.help("do not output the trailing delimiter"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(OPT_QUIET)
|
||||
.short("q")
|
||||
Arg::new(OPT_QUIET)
|
||||
.short('q')
|
||||
.long(OPT_QUIET)
|
||||
.help("suppress most error messages"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(OPT_SILENT)
|
||||
.short("s")
|
||||
Arg::new(OPT_SILENT)
|
||||
.short('s')
|
||||
.long(OPT_SILENT)
|
||||
.help("suppress most error messages"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(OPT_VERBOSE)
|
||||
.short("v")
|
||||
Arg::new(OPT_VERBOSE)
|
||||
.short('v')
|
||||
.long(OPT_VERBOSE)
|
||||
.help("report error message"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(OPT_ZERO)
|
||||
.short("z")
|
||||
Arg::new(OPT_ZERO)
|
||||
.short('z')
|
||||
.long(OPT_ZERO)
|
||||
.help("separate output with NUL rather than newline"),
|
||||
)
|
||||
.arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true))
|
||||
.arg(
|
||||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true),
|
||||
)
|
||||
}
|
||||
|
||||
fn show(path: &Path, no_newline: bool, use_zero: bool) -> std::io::Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue