diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 99b9d6b81..eb9766eb4 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -275,6 +275,7 @@ pub fn uu_app() -> Command { .after_help(LONG_HELP) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .args_override_self(true) .arg( Arg::new(options::INITIAL) .long(options::INITIAL) diff --git a/tests/by-util/test_expand.rs b/tests/by-util/test_expand.rs index f6802358c..a1173c496 100644 --- a/tests/by-util/test_expand.rs +++ b/tests/by-util/test_expand.rs @@ -392,3 +392,17 @@ fn test_comma_with_plus_4() { // 01234567890 .stdout_is("a b c"); } + +#[test] +fn test_args_override() { + new_ucmd!() + .args(&["-i", "-i", "alice_in_wonderland.txt"]) + .run() + .stdout_is( + "Alice was beginning to get very tired of sitting by\n\ + her sister on the bank, and of having nothing to do: once or twice\n\ + she had peeped into the book her sister was reading, but it had no\n\ + pictures or conversations in it, \"and what is the use of a book,\"\n\ + thought Alice \"without pictures or conversation?\"\n", + ); +} diff --git a/tests/fixtures/expand/alice_in_wonderland.txt b/tests/fixtures/expand/alice_in_wonderland.txt new file mode 100644 index 000000000..a95562a1c --- /dev/null +++ b/tests/fixtures/expand/alice_in_wonderland.txt @@ -0,0 +1,5 @@ +Alice was beginning to get very tired of sitting by +her sister on the bank, and of having nothing to do: once or twice +she had peeped into the book her sister was reading, but it had no +pictures or conversations in it, "and what is the use of a book," +thought Alice "without pictures or conversation?"