diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index df603427fb5..968682a264b 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -199,7 +199,8 @@ pub fn uu_app() -> Command { .long(options::TRUNCATE_SET1) .short('t') .help("first truncate SET1 to length of SET2") - .action(ArgAction::SetTrue), + .action(ArgAction::SetTrue) + .overrides_with(options::TRUNCATE_SET1), ) .arg(Arg::new(options::SETS).num_args(1..)) } diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 4825fa958b4..6adbc4022a0 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -300,7 +300,16 @@ fn test_truncate() { new_ucmd!() .args(&["-t", "abc", "xy"]) .pipe_in("abcde") - .run() + .succeeds() + .stdout_is("xycde"); // spell-checker:disable-line +} + +#[test] +fn test_truncate_multi() { + new_ucmd!() + .args(&["-tt", "-t", "abc", "xy"]) + .pipe_in("abcde") + .succeeds() .stdout_is("xycde"); // spell-checker:disable-line }