mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
feat: decompress with count
This commit is contained in:
parent
77c968fb2d
commit
862181ae0a
@ -166,7 +166,7 @@ pub fn decompress_file(
|
||||
},
|
||||
SevenZip => {
|
||||
sevenz_rust::decompress_file(input_file_path, output_dir).expect("can't decompress");
|
||||
1
|
||||
fs::read_dir(output_dir)?.count()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,8 @@ pub enum Error {
|
||||
Custom { reason: FinalError },
|
||||
/// Invalid format passed to `--format`
|
||||
InvalidFormat { reason: String },
|
||||
/// From sevenz_rust::Error
|
||||
SevenzipError(sevenz_rust::Error)
|
||||
}
|
||||
|
||||
/// Alias to std's Result with ouch's Error
|
||||
@ -139,6 +141,9 @@ impl fmt::Display for Error {
|
||||
Error::UnsupportedZipArchive(reason) => FinalError::with_title("Unsupported zip archive").detail(*reason),
|
||||
Error::InvalidFormat { reason } => FinalError::with_title("Invalid archive format").detail(reason.clone()),
|
||||
Error::Custom { reason } => reason.clone(),
|
||||
Error::SevenzipError( reason ) => {
|
||||
FinalError::with_title("7z error").detail(reason.to_string())
|
||||
},
|
||||
};
|
||||
|
||||
write!(f, "{err}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user