1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

relpath: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:40:49 +01:00
parent d52887e6c0
commit a02e40fcad
2 changed files with 8 additions and 18 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/relpath.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

@ -35,7 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.accept_any();
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 to = Path::new(matches.value_of(options::TO).unwrap()).to_path_buf(); // required
let from = match matches.value_of(options::FROM) {
@ -82,23 +82,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
println_verbatim(result).map_err_context(String::new)
}
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(options::DIR)
.short("d")
.takes_value(true)
.help("If any of FROM and TO is not subpath of DIR, output absolute path instead of relative"),
)
.arg(
Arg::with_name(options::TO)
.required(true)
.takes_value(true),
)
.arg(
Arg::with_name(options::FROM)
.takes_value(true),
)
.arg(Arg::new(options::DIR).short('d').takes_value(true).help(
"If any of FROM and TO is not subpath of DIR, output absolute path instead of relative",
))
.arg(Arg::new(options::TO).required(true).takes_value(true))
.arg(Arg::new(options::FROM).takes_value(true))
}