From 884ef1f54b9d340285ce9c378973e1da9e29d6fc Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 23 Mar 2024 21:04:42 +0100 Subject: [PATCH] comm: implement and test correct handling of repeated flags --- src/uu/comm/src/comm.rs | 1 + tests/by-util/test_comm.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 931d0a054..ee15a070e 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -178,6 +178,7 @@ pub fn uu_app() -> Command { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .args_override_self(true) .arg( Arg::new(options::COLUMN_1) .short('1') diff --git a/tests/by-util/test_comm.rs b/tests/by-util/test_comm.rs index ce3814eac..2dc385ef3 100644 --- a/tests/by-util/test_comm.rs +++ b/tests/by-util/test_comm.rs @@ -75,6 +75,14 @@ fn total_with_suppressed_regular_output() { .stdout_is_fixture("ab_total_suppressed_regular_output.expected"); } +#[test] +fn repeated_flags() { + new_ucmd!() + .args(&["--total", "-123123", "--total", "a", "b"]) + .succeeds() + .stdout_is_fixture("ab_total_suppressed_regular_output.expected"); +} + #[test] fn total_with_output_delimiter() { new_ucmd!()