1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #5302 from cakebaker/relpath_fix_5300

relpath: show error if no argument provided
This commit is contained in:
Sylvestre Ledru 2023-09-22 23:30:52 +02:00 committed by GitHub
commit d6da6fb546
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -82,6 +82,10 @@ pub fn uu_app() -> Command {
.arg(Arg::new(options::DIR).short('d').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::new(options::TO).value_hint(clap::ValueHint::AnyPath)) .arg(
Arg::new(options::TO)
.value_hint(clap::ValueHint::AnyPath)
.required(true),
)
.arg(Arg::new(options::FROM).value_hint(clap::ValueHint::AnyPath)) .arg(Arg::new(options::FROM).value_hint(clap::ValueHint::AnyPath))
} }

View file

@ -180,3 +180,10 @@ fn test_relpath_no_from_with_d() {
assert!(Path::new(&result_stdout).is_absolute()); assert!(Path::new(&result_stdout).is_absolute());
} }
} }
#[test]
fn test_relpath_no_to() {
new_ucmd!()
.fails()
.stderr_contains("required arguments were not provided");
}