mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Reformat code
This commit is contained in:
parent
17d9f17277
commit
250d2e231c
@ -285,7 +285,7 @@ fn compress_files(
|
||||
formats: Vec<Extension>,
|
||||
output_file: fs::File,
|
||||
output_dir: &Path,
|
||||
question_policy: QuestionPolicy
|
||||
question_policy: QuestionPolicy,
|
||||
) -> crate::Result<()> {
|
||||
// The next lines are for displaying the progress bar
|
||||
// If the input files contain a directory, then the total size will be underestimated
|
||||
@ -354,9 +354,11 @@ fn compress_files(
|
||||
}
|
||||
Zip => {
|
||||
eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET);
|
||||
eprintln!("\tThere is a limitation for .zip archives with extra extensions. (e.g. <file>.zip.gz)\
|
||||
eprintln!(
|
||||
"\tThere is a limitation for .zip archives with extra extensions. (e.g. <file>.zip.gz)\
|
||||
\n\tThe design of .zip makes it impossible to compress via stream, so it must be done entirely in memory.\
|
||||
\n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!");
|
||||
\n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!"
|
||||
);
|
||||
|
||||
// give user the option to continue compressing after warning is shown
|
||||
if !user_wants_to_continue_compressing(output_dir, question_policy)? {
|
||||
@ -513,9 +515,11 @@ fn decompress_file(
|
||||
}
|
||||
Zip => {
|
||||
eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET);
|
||||
eprintln!("\tThere is a limitation for .zip archives with extra extensions. (e.g. <file>.zip.gz)\
|
||||
eprintln!(
|
||||
"\tThere is a limitation for .zip archives with extra extensions. (e.g. <file>.zip.gz)\
|
||||
\n\tThe design of .zip makes it impossible to compress via stream, so it must be done entirely in memory.\
|
||||
\n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!");
|
||||
\n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!"
|
||||
);
|
||||
|
||||
// give user the option to continue decompressing after warning is shown
|
||||
if !user_wants_to_continue_decompressing(input_file_path, question_policy)? {
|
||||
@ -562,7 +566,7 @@ fn list_archive_contents(
|
||||
archive_path: &Path,
|
||||
formats: Vec<CompressionFormat>,
|
||||
list_options: ListOptions,
|
||||
question_policy: QuestionPolicy
|
||||
question_policy: QuestionPolicy,
|
||||
) -> crate::Result<()> {
|
||||
let reader = fs::File::open(&archive_path)?;
|
||||
|
||||
@ -605,9 +609,11 @@ fn list_archive_contents(
|
||||
Tar => crate::archive::tar::list_archive(reader)?,
|
||||
Zip => {
|
||||
eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET);
|
||||
eprintln!("\tThere is a limitation for .zip archives with extra extensions. (e.g. <file>.zip.gz)\
|
||||
eprintln!(
|
||||
"\tThere is a limitation for .zip archives with extra extensions. (e.g. <file>.zip.gz)\
|
||||
\n\tThe design of .zip makes it impossible to compress via stream, so it must be done entirely in memory.\
|
||||
\n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!");
|
||||
\n\tBy compressing .zip with extra compression formats, you can run out of RAM if the file is too large!"
|
||||
);
|
||||
|
||||
// give user the option to continue decompressing after warning is shown
|
||||
if !user_wants_to_continue_decompressing(archive_path, question_policy)? {
|
||||
|
@ -8,22 +8,13 @@ mod formatting;
|
||||
mod fs;
|
||||
mod question;
|
||||
|
||||
pub use formatting::{
|
||||
concatenate_os_str_list, nice_directory_display,
|
||||
strip_cur_dir, to_utf, Bytes
|
||||
};
|
||||
pub use fs::{
|
||||
cd_into_same_dir_as, clear_path, create_dir_if_non_existent,
|
||||
dir_is_empty, try_infer_extension
|
||||
};
|
||||
pub use formatting::{concatenate_os_str_list, nice_directory_display, strip_cur_dir, to_utf, Bytes};
|
||||
pub use fs::{cd_into_same_dir_as, clear_path, create_dir_if_non_existent, dir_is_empty, try_infer_extension};
|
||||
pub use question::{
|
||||
user_wants_to_continue_compressing, user_wants_to_continue_decompressing,
|
||||
create_or_ask_overwrite, user_wants_to_overwrite,
|
||||
QuestionPolicy
|
||||
};
|
||||
pub use utf8::{
|
||||
get_invalid_utf8_paths, is_invalid_utf8
|
||||
create_or_ask_overwrite, user_wants_to_continue_compressing, user_wants_to_continue_decompressing,
|
||||
user_wants_to_overwrite, QuestionPolicy,
|
||||
};
|
||||
pub use utf8::{get_invalid_utf8_paths, is_invalid_utf8};
|
||||
|
||||
mod utf8 {
|
||||
use std::{ffi::OsStr, path::PathBuf};
|
||||
|
Loading…
x
Reference in New Issue
Block a user