mktemp: allow default missing value

This commit is contained in:
David Matos 2022-10-30 19:57:39 +01:00 committed by Sylvestre Ledru
parent 9293cbb05b
commit 53c4b0b81e
2 changed files with 9 additions and 0 deletions

View file

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

View file

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