diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 6a69b774e..348a8ef26 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -18,7 +18,7 @@ path = "src/link.rs" libc = "0.2.42" uucore = { version=">=0.0.10", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } -clap = { version = "2.33", features = ["wrap_help"] } +clap = { version = "3.0", features = ["wrap_help", "cargo"] } [[bin]] name = "link" diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index a54b71999..3a771aecf 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -23,7 +23,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 files: Vec<_> = matches .values_of_os(options::FILES) @@ -36,16 +36,17 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .map_err_context(|| format!("cannot create link {} to {}", new.quote(), old.quote())) } -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::FILES) - .hidden(true) + Arg::new(options::FILES) + .hide(true) .required(true) .min_values(2) .max_values(2) - .takes_value(true), + .takes_value(true) + .allow_invalid_utf8(true), ) } diff --git a/tests/by-util/test_link.rs b/tests/by-util/test_link.rs index 3219a6591..5a84364e9 100644 --- a/tests/by-util/test_link.rs +++ b/tests/by-util/test_link.rs @@ -58,6 +58,6 @@ fn test_link_three_arguments() { "test_link_argument3", ]; ucmd.args(&arguments[..]).fails().stderr_contains( - format!("error: The value '{}' was provided to '...', but it wasn't expecting any more values", arguments[2]), + format!("error: The value '{}' was provided to '...' but it wasn't expecting any more values", arguments[2]), ); }