Skip to content

Commit

Permalink
tr: enable passing -t multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWiederhake committed Feb 24, 2024
1 parent 268af90 commit 44310f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/uu/tr/src/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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..))
}
11 changes: 10 additions & 1 deletion tests/by-util/test_tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 44310f4

Please sign in to comment.