Skip to content

Commit

Permalink
Merge pull request #5302 from cakebaker/relpath_fix_5300
Browse files Browse the repository at this point in the history
relpath: show error if no argument provided
  • Loading branch information
sylvestre authored Sep 22, 2023
2 parents 4094231 + 38831c4 commit d6da6fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/uu/relpath/src/relpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ pub fn uu_app() -> Command {
.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",
))
.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))
}
7 changes: 7 additions & 0 deletions tests/by-util/test_relpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,10 @@ fn test_relpath_no_from_with_d() {
assert!(Path::new(&result_stdout).is_absolute());
}
}

#[test]
fn test_relpath_no_to() {
new_ucmd!()
.fails()
.stderr_contains("required arguments were not provided");
}

0 comments on commit d6da6fb

Please sign in to comment.