mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
echo: make -e and -E override each other
This commit is contained in:
@@ -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!()
|
||||
|
||||
Reference in New Issue
Block a user