From c4ffeea3206259314d20f3e800dacf2c20f06b6f Mon Sep 17 00:00:00 2001 From: David Rebbe <1187684+ic3man5@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:19:30 -0500 Subject: [PATCH 1/2] sort: options -C and -c should be mutually exclusive but aren't --- src/uu/sort/src/sort.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index b95559746..f2677e661 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1371,14 +1371,14 @@ pub fn uu_app() -> Command { options::check::QUIET, options::check::DIAGNOSE_FIRST, ])) - .conflicts_with(options::OUTPUT) + .conflicts_with_all([options::OUTPUT, options::check::CHECK_SILENT]) .help("check for sorted input; do not sort"), ) .arg( Arg::new(options::check::CHECK_SILENT) .short('C') .long(options::check::CHECK_SILENT) - .conflicts_with(options::OUTPUT) + .conflicts_with_all([options::OUTPUT, options::check::CHECK]) .help( "exit successfully if the given file is already sorted, \ and exit with status 1 otherwise.", From f394a20d9a293a47ff40360649cf7034d00cf482 Mon Sep 17 00:00:00 2001 From: David Rebbe <1187684+ic3man5@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:09:24 -0500 Subject: [PATCH 2/2] test(sort): options -C and -c should be mutually exclusive but aren't --- tests/by-util/test_sort.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 9a12d3ef8..31889058e 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -1324,3 +1324,8 @@ fn test_human_blocks_r_and_q() { .succeeds() .stdout_is(output); } + +#[test] +fn test_args_check_conflict() { + new_ucmd!().arg("-c").arg("-C").fails(); +}