1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

tr: enable passing -t multiple times

This commit is contained in:
Ben Wiederhake 2024-02-24 18:26:30 +01:00
parent 268af90843
commit 44310f426c
2 changed files with 12 additions and 2 deletions

View file

@ -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..))
}

View file

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