mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
tr: enable passing -d multiple times
This commit is contained in:
parent
cad94a69be
commit
dc664006fe
2 changed files with 28 additions and 1 deletions
|
@ -179,7 +179,8 @@ pub fn uu_app() -> Command {
|
||||||
.short('d')
|
.short('d')
|
||||||
.long(options::DELETE)
|
.long(options::DELETE)
|
||||||
.help("delete characters in SET1, do not translate")
|
.help("delete characters in SET1, do not translate")
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue)
|
||||||
|
.overrides_with(options::DELETE),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::SQUEEZE)
|
Arg::new(options::SQUEEZE)
|
||||||
|
|
|
@ -46,6 +46,32 @@ fn test_delete() {
|
||||||
.stdout_is("BD");
|
.stdout_is("BD");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_delete_afterwards_is_not_flag() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["a-z", "-d"])
|
||||||
|
.pipe_in("aBcD")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is("-BdD");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_delete_multi() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["-d", "-d", "a-z"])
|
||||||
|
.pipe_in("aBcD")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is("BD");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_delete_late() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["-d", "a-z", "-d"])
|
||||||
|
.fails()
|
||||||
|
.stderr_contains("extra operand '-d'");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_delete_complement() {
|
fn test_delete_complement() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue