relpath: update to clap 4

This commit is contained in:
Terts Diepraam 2022-09-30 16:19:28 +02:00
parent 2faf0b62df
commit 63147b9c83
2 changed files with 5 additions and 14 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/relpath.rs" path = "src/relpath.rs"
[dependencies] [dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] } clap = { version = "4.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] } uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }
[[bin]] [[bin]]

View file

@ -76,24 +76,15 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
println_verbatim(result).map_err_context(String::new) println_verbatim(result).map_err_context(String::new)
} }
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app() -> Command {
Command::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))
.infer_long_args(true) .infer_long_args(true)
.arg(Arg::new(options::DIR).short('d').takes_value(true).help( .arg(Arg::new(options::DIR).short('d').help(
"If any of FROM and TO is not subpath of DIR, output absolute path instead of relative", "If any of FROM and TO is not subpath of DIR, output absolute path instead of relative",
)) ))
.arg( .arg(Arg::new(options::TO).value_hint(clap::ValueHint::AnyPath))
Arg::new(options::TO) .arg(Arg::new(options::FROM).value_hint(clap::ValueHint::AnyPath))
.required(true)
.takes_value(true)
.value_hint(clap::ValueHint::AnyPath),
)
.arg(
Arg::new(options::FROM)
.takes_value(true)
.value_hint(clap::ValueHint::AnyPath),
)
} }