mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
cksum: move the code where needed
This commit is contained in:
parent
6a489f5ee7
commit
3b607f1c7c
1 changed files with 20 additions and 23 deletions
|
@ -207,16 +207,9 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
|
||||||
binary_flag_default
|
binary_flag_default
|
||||||
};
|
};
|
||||||
let check = matches.get_flag("check");
|
let check = matches.get_flag("check");
|
||||||
let tag = matches.get_flag("tag");
|
|
||||||
let nonames = *matches
|
|
||||||
.try_get_one("no-names")
|
|
||||||
.unwrap_or(None)
|
|
||||||
.unwrap_or(&false);
|
|
||||||
let status = matches.get_flag("status");
|
let status = matches.get_flag("status");
|
||||||
let quiet = matches.get_flag("quiet") || status;
|
let quiet = matches.get_flag("quiet") || status;
|
||||||
//let strict = matches.get_flag("strict");
|
|
||||||
let warn = matches.get_flag("warn") && !status;
|
let warn = matches.get_flag("warn") && !status;
|
||||||
let zero = matches.get_flag("zero");
|
|
||||||
let ignore_missing = matches.get_flag("ignore-missing");
|
let ignore_missing = matches.get_flag("ignore-missing");
|
||||||
|
|
||||||
if ignore_missing && !check {
|
if ignore_missing && !check {
|
||||||
|
@ -224,22 +217,6 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
|
||||||
return Err(ChecksumError::IgnoreNotCheck.into());
|
return Err(ChecksumError::IgnoreNotCheck.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let opts = Options {
|
|
||||||
algoname: algo.name,
|
|
||||||
digest: (algo.create_fn)(),
|
|
||||||
output_bits: algo.bits,
|
|
||||||
binary,
|
|
||||||
//check,
|
|
||||||
tag,
|
|
||||||
nonames,
|
|
||||||
//status,
|
|
||||||
//quiet,
|
|
||||||
//strict,
|
|
||||||
//warn,
|
|
||||||
zero,
|
|
||||||
//ignore_missing,
|
|
||||||
};
|
|
||||||
|
|
||||||
if check {
|
if check {
|
||||||
let text_flag = matches.get_flag("text");
|
let text_flag = matches.get_flag("text");
|
||||||
let binary_flag = matches.get_flag("binary");
|
let binary_flag = matches.get_flag("binary");
|
||||||
|
@ -270,6 +247,26 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nonames = *matches
|
||||||
|
.try_get_one("no-names")
|
||||||
|
.unwrap_or(None)
|
||||||
|
.unwrap_or(&false);
|
||||||
|
let zero = matches.get_flag("zero");
|
||||||
|
|
||||||
|
let opts = Options {
|
||||||
|
algoname: algo.name,
|
||||||
|
digest: (algo.create_fn)(),
|
||||||
|
output_bits: algo.bits,
|
||||||
|
binary,
|
||||||
|
tag: matches.get_flag("tag"),
|
||||||
|
nonames,
|
||||||
|
//status,
|
||||||
|
//quiet,
|
||||||
|
//warn,
|
||||||
|
zero,
|
||||||
|
//ignore_missing,
|
||||||
|
};
|
||||||
|
|
||||||
// Show the hashsum of the input
|
// Show the hashsum of the input
|
||||||
match matches.get_many::<OsString>(options::FILE) {
|
match matches.get_many::<OsString>(options::FILE) {
|
||||||
Some(files) => hashsum(opts, files.map(|f| f.as_os_str())),
|
Some(files) => hashsum(opts, files.map(|f| f.as_os_str())),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue