1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #7191 from ic3man5/issue_7184

sort: options -C and -c should be mutually exclusive but aren't
This commit is contained in:
Daniel Hofstetter 2025-01-23 10:51:45 +01:00 committed by GitHub
commit 6c8ec8985b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -1371,14 +1371,14 @@ pub fn uu_app() -> Command {
options::check::QUIET, options::check::QUIET,
options::check::DIAGNOSE_FIRST, 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"), .help("check for sorted input; do not sort"),
) )
.arg( .arg(
Arg::new(options::check::CHECK_SILENT) Arg::new(options::check::CHECK_SILENT)
.short('C') .short('C')
.long(options::check::CHECK_SILENT) .long(options::check::CHECK_SILENT)
.conflicts_with(options::OUTPUT) .conflicts_with_all([options::OUTPUT, options::check::CHECK])
.help( .help(
"exit successfully if the given file is already sorted, \ "exit successfully if the given file is already sorted, \
and exit with status 1 otherwise.", and exit with status 1 otherwise.",

View file

@ -1324,3 +1324,8 @@ fn test_human_blocks_r_and_q() {
.succeeds() .succeeds()
.stdout_is(output); .stdout_is(output);
} }
#[test]
fn test_args_check_conflict() {
new_ucmd!().arg("-c").arg("-C").fails();
}