mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
echo: make -e and -E override each other
This commit is contained in:
parent
d63d4a7658
commit
191eb9ac12
2 changed files with 17 additions and 2 deletions
|
@ -154,13 +154,15 @@ pub fn uu_app() -> Command {
|
|||
Arg::new(options::ENABLE_BACKSLASH_ESCAPE)
|
||||
.short('e')
|
||||
.help("enable interpretation of backslash escapes")
|
||||
.action(ArgAction::SetTrue),
|
||||
.action(ArgAction::SetTrue)
|
||||
.overrides_with(options::DISABLE_BACKSLASH_ESCAPE),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::DISABLE_BACKSLASH_ESCAPE)
|
||||
.short('E')
|
||||
.help("disable interpretation of backslash escapes (default)")
|
||||
.action(ArgAction::SetTrue),
|
||||
.action(ArgAction::SetTrue)
|
||||
.overrides_with(options::ENABLE_BACKSLASH_ESCAPE),
|
||||
)
|
||||
.arg(Arg::new(options::STRING).action(ArgAction::Append))
|
||||
}
|
||||
|
|
|
@ -117,6 +117,19 @@ fn test_escape_newline() {
|
|||
.stdout_only("\na\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_override() {
|
||||
new_ucmd!()
|
||||
.args(&["-e", "-E", "\\na"])
|
||||
.succeeds()
|
||||
.stdout_only("\\na\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-E", "-e", "\\na"])
|
||||
.succeeds()
|
||||
.stdout_only("\na\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_no_further_output() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Reference in a new issue