summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hofstetter <daniel.hofstetter@42dh.com>2024-10-31 09:43:25 +0100
committerGitHub <noreply@github.com>2024-10-31 09:43:25 +0100
commitc808faf10f86d048abd6e2c169b1331466d2c663 (patch)
tree286cda206db9b3c29e344b49814ef6a80f66fd0f
parentbf6de81a1f0a30c9a48eb9921bbed2656c7489f2 (diff)
parent8cecebc05053df1ddd30b19f45365716b4755842 (diff)
Merge pull request #6831 from DaringCuteSeal/mkdir-opt
mkdir: allow --parent to be provided more than once
-rw-r--r--src/uu/mkdir/src/mkdir.rs1
-rw-r--r--tests/by-util/test_mkdir.rs14
2 files changed, 14 insertions, 1 deletions
diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs
index 46084ba9ee..9928271e75 100644
--- a/src/uu/mkdir/src/mkdir.rs
+++ b/src/uu/mkdir/src/mkdir.rs
@@ -114,6 +114,7 @@ pub fn uu_app() -> Command {
.short('p')
.long(options::PARENTS)
.help("make parent directories as needed")
+ .overrides_with(options::PARENTS)
.action(ArgAction::SetTrue),
)
.arg(
diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs
index b9d5275f49..a0b926689d 100644
--- a/tests/by-util/test_mkdir.rs
+++ b/tests/by-util/test_mkdir.rs
@@ -61,9 +61,21 @@ fn test_mkdir_parent() {
let test_dir = "parent_dir/child_dir";
scene.ucmd().arg("-p").arg(test_dir).succeeds();
- scene.ucmd().arg("-p").arg(test_dir).succeeds();
+ scene.ucmd().arg("-p").arg("-p").arg(test_dir).succeeds();
scene.ucmd().arg("--parent").arg(test_dir).succeeds();
+ scene
+ .ucmd()
+ .arg("--parent")
+ .arg("--parent")
+ .arg(test_dir)
+ .succeeds();
scene.ucmd().arg("--parents").arg(test_dir).succeeds();
+ scene
+ .ucmd()
+ .arg("--parents")
+ .arg("--parents")
+ .arg(test_dir)
+ .succeeds();
}
#[test]