mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
shred: refactor get_size
This commit is contained in:
parent
b93bae2964
commit
f10059db02
1 changed files with 8 additions and 8 deletions
|
@ -320,16 +320,16 @@ pub fn uu_app() -> Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_size(size_str_opt: Option<String>) -> Option<u64> {
|
fn get_size(size_str_opt: Option<String>) -> Option<u64> {
|
||||||
match size_str_opt {
|
size_str_opt
|
||||||
Some(size) => match parse_size(size.as_str()) {
|
.as_ref()
|
||||||
Ok(res) => Some(res),
|
.and_then(|size| parse_size(size.as_str()).ok())
|
||||||
Err(_) => {
|
.or_else(|| {
|
||||||
|
if let Some(size) = size_str_opt {
|
||||||
show_error!("invalid file size: {}", size.quote());
|
show_error!("invalid file size: {}", size.quote());
|
||||||
std::process::exit(1)
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
},
|
None
|
||||||
None => None,
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pass_name(pass_type: &PassType) -> String {
|
fn pass_name(pass_type: &PassType) -> String {
|
||||||
|
|
Loading…
Reference in a new issue