mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #3356 from sylvestre/rm
rm: rename none by --interactive=never to fix ../gnu/tests/rm/i-never.sh
This commit is contained in:
commit
3236daabf2
2 changed files with 24 additions and 3 deletions
|
@ -24,7 +24,7 @@ use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Clone, Copy)]
|
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||||
enum InteractiveMode {
|
enum InteractiveMode {
|
||||||
None,
|
Never,
|
||||||
Once,
|
Once,
|
||||||
Always,
|
Always,
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
InteractiveMode::Once
|
InteractiveMode::Once
|
||||||
} else if matches.is_present(OPT_INTERACTIVE) {
|
} else if matches.is_present(OPT_INTERACTIVE) {
|
||||||
match matches.value_of(OPT_INTERACTIVE).unwrap() {
|
match matches.value_of(OPT_INTERACTIVE).unwrap() {
|
||||||
"none" => InteractiveMode::None,
|
"never" => InteractiveMode::Never,
|
||||||
"once" => InteractiveMode::Once,
|
"once" => InteractiveMode::Once,
|
||||||
"always" => InteractiveMode::Always,
|
"always" => InteractiveMode::Always,
|
||||||
val => {
|
val => {
|
||||||
|
@ -112,7 +112,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
InteractiveMode::None
|
InteractiveMode::Never
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM),
|
one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM),
|
||||||
|
|
|
@ -326,3 +326,24 @@ fn test_rm_silently_accepts_presume_input_tty2() {
|
||||||
|
|
||||||
assert!(!at.file_exists(file_2));
|
assert!(!at.file_exists(file_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_rm_interactive_never() {
|
||||||
|
let scene = TestScenario::new(util_name!());
|
||||||
|
let at = &scene.fixtures;
|
||||||
|
|
||||||
|
let file_2 = "test_rm_interactive";
|
||||||
|
|
||||||
|
at.touch(file_2);
|
||||||
|
#[cfg(feature = "chmod")]
|
||||||
|
scene.ccmd("chmod").arg("0").arg(file_2).succeeds();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.arg("--interactive=never")
|
||||||
|
.arg(file_2)
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is("");
|
||||||
|
|
||||||
|
assert!(!at.file_exists(file_2));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue