1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #2461 from miDeb/sort/check-no-out

sort: disable -o with -C and -c
This commit is contained in:
Terts Diepraam 2021-07-01 13:07:05 +02:00 committed by GitHub
commit 7a0a7aecc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -1198,12 +1198,14 @@ pub fn uu_app() -> App<'static, 'static> {
options::check::QUIET, options::check::QUIET,
options::check::DIAGNOSE_FIRST, options::check::DIAGNOSE_FIRST,
]) ])
.conflicts_with(options::OUTPUT)
.help("check for sorted input; do not sort"), .help("check for sorted input; do not sort"),
) )
.arg( .arg(
Arg::with_name(options::check::CHECK_SILENT) Arg::with_name(options::check::CHECK_SILENT)
.short("C") .short("C")
.long(options::check::CHECK_SILENT) .long(options::check::CHECK_SILENT)
.conflicts_with(options::OUTPUT)
.help("exit successfully if the given file is already sorted, and exit with status 1 otherwise."), .help("exit successfully if the given file is already sorted, and exit with status 1 otherwise."),
) )
.arg( .arg(

View file

@ -937,3 +937,17 @@ fn test_sigpipe_panic() {
Ok(String::new()) Ok(String::new())
); );
} }
#[test]
fn test_conflict_check_out() {
let check_flags = ["-c=silent", "-c=quiet", "-c=diagnose-first", "-c", "-C"];
for check_flag in &check_flags {
new_ucmd!()
.arg(check_flag)
.arg("-o=/dev/null")
.fails()
.stderr_contains(
"error: The argument '--output <FILENAME>' cannot be used with '--check",
);
}
}