Skip to content

Commit

Permalink
Merge pull request uutils#7191 from ic3man5/issue_7184
Browse files Browse the repository at this point in the history
sort: options -C and -c should be mutually exclusive but aren't
  • Loading branch information
cakebaker authored Jan 23, 2025
2 parents 5b05670 + f394a20 commit 6c8ec89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/uu/sort/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
5 changes: 5 additions & 0 deletions tests/by-util/test_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 6c8ec89

Please sign in to comment.