Skip to content

Commit

Permalink
rmdir: require argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sgvictorino committed Oct 17, 2024
1 parent 406a0cf commit 388acaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/uu/rmdir/src/rmdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ pub fn uu_app() -> Command {
Arg::new(ARG_DIRS)
.action(ArgAction::Append)
.num_args(1..)
.required(true)
.value_parser(ValueParser::os_string())
.value_hint(clap::ValueHint::DirPath),
)
Expand Down
8 changes: 8 additions & 0 deletions tests/by-util/test_rmdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}

#[test]
fn test_no_arg() {
new_ucmd!()
.fails()
.code_is(1)
.stderr_contains("error: the following required arguments were not provided:");
}

#[test]
fn test_rmdir_empty_directory_no_parents() {
let (at, mut ucmd) = at_and_ucmd!();
Expand Down

0 comments on commit 388acaa

Please sign in to comment.