mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
link: clap 3
This commit is contained in:
parent
83f39619d5
commit
0531f13cfd
3 changed files with 8 additions and 7 deletions
|
@ -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"
|
||||
|
|
|
@ -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),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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 '<FILES>...', but it wasn't expecting any more values", arguments[2]),
|
||||
format!("error: The value '{}' was provided to '<FILES>...' but it wasn't expecting any more values", arguments[2]),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue