Revert "cksum: Move --ckeck's deps by clap"

This reverts commit 1d63bdd163.
This commit is contained in:
Dorian Peron
2026-01-09 13:48:48 +01:00
parent 6e87b83a8d
commit ced5dc92f4
+18 -15
View File
@@ -139,11 +139,19 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let check = matches.get_flag(options::CHECK);
let ignore_missing = matches.get_flag(options::IGNORE_MISSING);
let warn = matches.get_flag(options::WARN);
let quiet = matches.get_flag(options::QUIET);
let strict = matches.get_flag(options::STRICT);
let status = matches.get_flag(options::STATUS);
let check_flag = |flag| match (check, matches.get_flag(flag)) {
(_, false) => Ok(false),
(true, true) => Ok(true),
(false, true) => Err(ChecksumError::CheckOnlyFlag(flag.into())),
};
// Each of the following flags are only expected in --check mode.
// If we encounter them otherwise, end with an error.
let ignore_missing = check_flag(options::IGNORE_MISSING)?;
let warn = check_flag(options::WARN)?;
let quiet = check_flag(options::QUIET)?;
let strict = check_flag(options::STRICT)?;
let status = check_flag(options::STATUS)?;
let algo_cli = matches
.get_one::<String>(options::ALGORITHM)
@@ -276,8 +284,7 @@ pub fn uu_app() -> Command {
Arg::new(options::STRICT)
.long(options::STRICT)
.help(translate!("cksum-help-strict"))
.action(ArgAction::SetTrue)
.requires(options::CHECK),
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::CHECK)
@@ -317,31 +324,27 @@ pub fn uu_app() -> Command {
.long("warn")
.help(translate!("cksum-help-warn"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::STATUS, options::QUIET])
.requires(options::CHECK),
.overrides_with_all([options::STATUS, options::QUIET]),
)
.arg(
Arg::new(options::STATUS)
.long("status")
.help(translate!("cksum-help-status"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::WARN, options::QUIET])
.requires(options::CHECK),
.overrides_with_all([options::WARN, options::QUIET]),
)
.arg(
Arg::new(options::QUIET)
.long(options::QUIET)
.help(translate!("cksum-help-quiet"))
.action(ArgAction::SetTrue)
.overrides_with_all([options::WARN, options::STATUS])
.requires(options::CHECK),
.overrides_with_all([options::WARN, options::STATUS]),
)
.arg(
Arg::new(options::IGNORE_MISSING)
.long(options::IGNORE_MISSING)
.help(translate!("cksum-help-ignore-missing"))
.action(ArgAction::SetTrue)
.requires(options::CHECK),
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::ZERO)