From 907a8ab6cab4dd43383060111bdbcfba97999903 Mon Sep 17 00:00:00 2001 From: oech3 <> Date: Sat, 3 Jan 2026 23:31:13 +0900 Subject: [PATCH] cksum: Move --check confliction to clap --- src/uu/cksum/src/cksum.rs | 11 +++-------- tests/by-util/test_cksum.rs | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index 3d814ae6f24..2c8b271e921 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -134,14 +134,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { return Err(ChecksumError::AlgorithmNotSupportedWithCheck.into()); } - let text_flag = matches.get_flag(options::TEXT); - let binary_flag = matches.get_flag(options::BINARY); - let tag = matches.get_flag(options::TAG); - - if tag || binary_flag || text_flag { - return Err(ChecksumError::BinaryTextConflict.into()); - } - // Execute the checksum validation based on the presence of files or the use of stdin let verbose = ChecksumVerbose::new(status, quiet, warn); @@ -251,6 +243,9 @@ pub fn uu_app() -> Command { .short('c') .long(options::CHECK) .help(translate!("cksum-help-check")) + .conflicts_with(options::TAG) + .conflicts_with(options::BINARY) + .conflicts_with(options::TEXT) .action(ArgAction::SetTrue), ) .arg( diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index d1abe3409ba..40f49fc70f8 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -1216,7 +1216,7 @@ fn test_conflicting_options() { .fails_with_code(1) .no_stdout() .stderr_contains( - "cksum: the --binary and --text options are meaningless when verifying checksums", + "cannot be used with", //clap generated error ); scene @@ -1228,7 +1228,7 @@ fn test_conflicting_options() { .fails_with_code(1) .no_stdout() .stderr_contains( - "cksum: the --binary and --text options are meaningless when verifying checksums", + "cannot be used with", //clap generated error ); }