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>,
|
formats: Vec<Extension>,
|
||||||
output_file: fs::File,
|
output_file: fs::File,
|
||||||
output_dir: &Path,
|
output_dir: &Path,
|
||||||
question_policy: QuestionPolicy
|
question_policy: QuestionPolicy,
|
||||||
) -> crate::Result<()> {
|
) -> crate::Result<()> {
|
||||||
// The next lines are for displaying the progress bar
|
// The next lines are for displaying the progress bar
|
||||||
// If the input files contain a directory, then the total size will be underestimated
|
// If the input files contain a directory, then the total size will be underestimated
|
||||||
@ -354,9 +354,11 @@ fn compress_files(
|
|||||||
}
|
}
|
||||||
Zip => {
|
Zip => {
|
||||||
eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET);
|
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\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
|
// give user the option to continue compressing after warning is shown
|
||||||
if !user_wants_to_continue_compressing(output_dir, question_policy)? {
|
if !user_wants_to_continue_compressing(output_dir, question_policy)? {
|
||||||
@ -513,9 +515,11 @@ fn decompress_file(
|
|||||||
}
|
}
|
||||||
Zip => {
|
Zip => {
|
||||||
eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET);
|
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\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
|
// give user the option to continue decompressing after warning is shown
|
||||||
if !user_wants_to_continue_decompressing(input_file_path, question_policy)? {
|
if !user_wants_to_continue_decompressing(input_file_path, question_policy)? {
|
||||||
@ -562,7 +566,7 @@ fn list_archive_contents(
|
|||||||
archive_path: &Path,
|
archive_path: &Path,
|
||||||
formats: Vec<CompressionFormat>,
|
formats: Vec<CompressionFormat>,
|
||||||
list_options: ListOptions,
|
list_options: ListOptions,
|
||||||
question_policy: QuestionPolicy
|
question_policy: QuestionPolicy,
|
||||||
) -> crate::Result<()> {
|
) -> crate::Result<()> {
|
||||||
let reader = fs::File::open(&archive_path)?;
|
let reader = fs::File::open(&archive_path)?;
|
||||||
|
|
||||||
@ -605,9 +609,11 @@ fn list_archive_contents(
|
|||||||
Tar => crate::archive::tar::list_archive(reader)?,
|
Tar => crate::archive::tar::list_archive(reader)?,
|
||||||
Zip => {
|
Zip => {
|
||||||
eprintln!("{orange}[WARNING]{reset}", orange = *colors::ORANGE, reset = *colors::RESET);
|
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\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
|
// give user the option to continue decompressing after warning is shown
|
||||||
if !user_wants_to_continue_decompressing(archive_path, question_policy)? {
|
if !user_wants_to_continue_decompressing(archive_path, question_policy)? {
|
||||||
|
@ -8,22 +8,13 @@ mod formatting;
|
|||||||
mod fs;
|
mod fs;
|
||||||
mod question;
|
mod question;
|
||||||
|
|
||||||
pub use formatting::{
|
pub use formatting::{concatenate_os_str_list, nice_directory_display, strip_cur_dir, to_utf, Bytes};
|
||||||
concatenate_os_str_list, nice_directory_display,
|
pub use fs::{cd_into_same_dir_as, clear_path, create_dir_if_non_existent, dir_is_empty, try_infer_extension};
|
||||||
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::{
|
pub use question::{
|
||||||
user_wants_to_continue_compressing, user_wants_to_continue_decompressing,
|
create_or_ask_overwrite, user_wants_to_continue_compressing, user_wants_to_continue_decompressing,
|
||||||
create_or_ask_overwrite, user_wants_to_overwrite,
|
user_wants_to_overwrite, QuestionPolicy,
|
||||||
QuestionPolicy
|
|
||||||
};
|
|
||||||
pub use utf8::{
|
|
||||||
get_invalid_utf8_paths, is_invalid_utf8
|
|
||||||
};
|
};
|
||||||
|
pub use utf8::{get_invalid_utf8_paths, is_invalid_utf8};
|
||||||
|
|
||||||
mod utf8 {
|
mod utf8 {
|
||||||
use std::{ffi::OsStr, path::PathBuf};
|
use std::{ffi::OsStr, path::PathBuf};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user