mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
truncate: use map_err
instead of unwrap_or_else
This commit is contained in:
parent
ea5541db56
commit
39f8329222
1 changed files with 4 additions and 6 deletions
|
@ -116,15 +116,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.override_usage(&usage[..])
|
||||
.after_help(&long_usage[..])
|
||||
.try_get_matches_from(args)
|
||||
.unwrap_or_else(|e| {
|
||||
.map_err(|e| {
|
||||
e.print().expect("Error writing clap::Error");
|
||||
match e.kind {
|
||||
clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => {
|
||||
std::process::exit(0)
|
||||
}
|
||||
_ => std::process::exit(1),
|
||||
clap::ErrorKind::DisplayHelp | clap::ErrorKind::DisplayVersion => 0,
|
||||
_ => 1,
|
||||
}
|
||||
});
|
||||
})?;
|
||||
|
||||
let files: Vec<String> = matches
|
||||
.values_of(options::ARG_FILES)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue