1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 11:46:17 +00:00

Merge pull request #6790 from sgvictorino/require-mkdir-rmdir-args

mkdir/rmdir: require arguments
This commit is contained in:
Sylvestre Ledru 2024-10-20 17:15:25 +02:00 committed by GitHub
commit 5b881a0766
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 0 deletions

View file

@ -127,6 +127,7 @@ pub fn uu_app() -> Command {
Arg::new(options::DIRS)
.action(ArgAction::Append)
.num_args(1..)
.required(true)
.value_parser(ValueParser::os_string())
.value_hint(clap::ValueHint::DirPath),
)

View file

@ -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),
)

View file

@ -15,6 +15,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_mkdir_mkdir() {
new_ucmd!().arg("test_dir").succeeds();

View file

@ -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!();