mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
link: update to clap 4
This commit is contained in:
parent
6eb7c64f7a
commit
838479f86a
3 changed files with 9 additions and 11 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
|||
path = "src/link.rs"
|
||||
|
||||
[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" }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -35,7 +35,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.map_err_context(|| format!("cannot create link {} to {}", new.quote(), old.quote()))
|
||||
}
|
||||
|
||||
pub fn uu_app<'a>() -> Command<'a> {
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
|
@ -45,9 +45,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::FILES)
|
||||
.hide(true)
|
||||
.required(true)
|
||||
.min_values(2)
|
||||
.max_values(2)
|
||||
.takes_value(true)
|
||||
.num_args(2)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.value_parser(ValueParser::os_string()),
|
||||
)
|
||||
|
|
|
@ -50,9 +50,9 @@ fn test_link_nonexistent_file() {
|
|||
fn test_link_one_argument() {
|
||||
let (_, mut ucmd) = at_and_ucmd!();
|
||||
let file = "test_link_argument";
|
||||
ucmd.args(&[file]).fails().stderr_contains(
|
||||
"error: The argument '<FILES>...' requires at least 2 values but only 1 was provided",
|
||||
);
|
||||
ucmd.args(&[file])
|
||||
.fails()
|
||||
.stderr_contains("requires 2 values");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -63,7 +63,7 @@ fn test_link_three_arguments() {
|
|||
"test_link_argument2",
|
||||
"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]),
|
||||
);
|
||||
ucmd.args(&arguments[..])
|
||||
.fails()
|
||||
.stderr_contains("requires 2 values");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue