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

sort: disable -o with -C and -c

This commit is contained in:
Michael Debertol 2021-06-27 15:34:20 +02:00
parent 5fce7ecbaa
commit d3732e08c4
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::DIAGNOSE_FIRST,
])
.conflicts_with(options::OUTPUT)
.help("check for sorted input; do not sort"),
)
.arg(
Arg::with_name(options::check::CHECK_SILENT)
.short("C")
.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."),
)
.arg(

View file

@ -941,3 +941,17 @@ fn test_sigpipe_panic() {
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",
);
}
}