diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index ef152f01a7b..02e11436061 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -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), ) diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index 086d43748ab..0708a8bd5d8 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -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!();