Merge pull request #6831 from DaringCuteSeal/mkdir-opt

mkdir: allow --parent to be provided more than once
This commit is contained in:
Daniel Hofstetter 2024-10-31 09:43:25 +01:00 committed by GitHub
commit c808faf10f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -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(

View file

@ -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]