From fe234164f40e1bc880b545b0cfc349a57a155cb3 Mon Sep 17 00:00:00 2001 From: Solomon Victorino Date: Thu, 17 Oct 2024 16:31:51 -0600 Subject: [PATCH] rmdir: require argument --- src/uu/rmdir/src/rmdir.rs | 1 + tests/by-util/test_rmdir.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index ef152f01a..02e114360 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 086d43748..0708a8bd5 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!();