Skip to content

Commit

Permalink
mktemp: allow default missing value
Browse files Browse the repository at this point in the history
  • Loading branch information
dmatos2012 authored and sylvestre committed Nov 3, 2022
1 parent 9293cbb commit 53c4b0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/uu/mktemp/src/mktemp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ pub fn uu_app() -> Command {
may contain slashes, but mktemp creates only the final component",
)
.value_name("DIR")
// Allows use of default argument just by setting --tmpdir. Else,
// use provided input to generate tmpdir
.num_args(0..=1)
.value_hint(clap::ValueHint::DirPath),
)
.arg(
Expand Down
6 changes: 6 additions & 0 deletions tests/by-util/test_mktemp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,3 +825,9 @@ fn test_nonexistent_dir_prefix() {
);
}
}

#[test]
fn test_default_missing_value() {
let scene = TestScenario::new(util_name!());
scene.ucmd().arg("-d").arg("--tmpdir").succeeds();
}

0 comments on commit 53c4b0b

Please sign in to comment.