1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

rm: fix 3 leading hyphens for ---presume-input-tty

This commit is contained in:
Terts Diepraam 2022-01-18 12:54:50 +01:00
parent 951f3bb689
commit 270a6ee83e
2 changed files with 4 additions and 27 deletions

View file

@ -51,7 +51,7 @@ static OPT_PROMPT_MORE: &str = "prompt-more";
static OPT_RECURSIVE: &str = "recursive"; static OPT_RECURSIVE: &str = "recursive";
static OPT_RECURSIVE_R: &str = "recursive_R"; static OPT_RECURSIVE_R: &str = "recursive_R";
static OPT_VERBOSE: &str = "verbose"; static OPT_VERBOSE: &str = "verbose";
static PRESUME_INPUT_TTY: &str = "presume-input-tty"; static PRESUME_INPUT_TTY: &str = "-presume-input-tty";
static ARG_FILES: &str = "files"; static ARG_FILES: &str = "files";
@ -219,9 +219,12 @@ pub fn uu_app<'a>() -> App<'a> {
// It is relatively difficult to ensure that there is a tty on stdin. // It is relatively difficult to ensure that there is a tty on stdin.
// Since rm acts differently depending on that, without this option, // Since rm acts differently depending on that, without this option,
// it'd be harder to test the parts of rm that depend on that setting. // it'd be harder to test the parts of rm that depend on that setting.
// In contrast with Arg::long, Arg::alias does not strip leading
// hyphens. Therefore it supports 3 leading hyphens.
.arg( .arg(
Arg::new(PRESUME_INPUT_TTY) Arg::new(PRESUME_INPUT_TTY)
.long(PRESUME_INPUT_TTY) .long(PRESUME_INPUT_TTY)
.alias(PRESUME_INPUT_TTY)
.hide(true) .hide(true)
) )
.arg( .arg(

View file

@ -316,19 +316,6 @@ fn test_rm_verbose_slash() {
} }
#[test] #[test]
fn test_rm_silently_accepts_presume_input_tty1() {
let (at, mut ucmd) = at_and_ucmd!();
let file_1 = "test_rm_silently_accepts_presume_input_tty1";
at.touch(file_1);
ucmd.arg("--presume-input-tty").arg(file_1).succeeds();
assert!(!at.file_exists(file_1));
}
#[test]
#[ignore]
fn test_rm_silently_accepts_presume_input_tty2() { fn test_rm_silently_accepts_presume_input_tty2() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let file_2 = "test_rm_silently_accepts_presume_input_tty2"; let file_2 = "test_rm_silently_accepts_presume_input_tty2";
@ -339,16 +326,3 @@ fn test_rm_silently_accepts_presume_input_tty2() {
assert!(!at.file_exists(file_2)); assert!(!at.file_exists(file_2));
} }
#[test]
#[ignore]
fn test_rm_silently_accepts_presume_input_tty3() {
let (at, mut ucmd) = at_and_ucmd!();
let file_3 = "test_rm_silently_accepts_presume_input_tty3";
at.touch(file_3);
ucmd.arg("----presume-input-tty").arg(file_3).succeeds();
assert!(!at.file_exists(file_3));
}