Skip to content

Commit

Permalink
better args order, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
a-moreira committed Dec 19, 2022
1 parent e26323b commit 0ceb84d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/archive/tar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn unpack_archive(reader: Box<dyn Read>, output_folder: &Path, quiet: bool)
format_size(file.size(), DECIMAL),
);

files_unpacked.push(file_path);
files_unpacked.push(file_path);
}
}

Expand Down Expand Up @@ -86,8 +86,8 @@ pub fn build_archive_from_paths<W>(
input_filenames: &[PathBuf],
output_path: &Path,
writer: W,
quiet: bool,
file_visibility_policy: FileVisibilityPolicy,
quiet: bool,
) -> crate::Result<W>
where
W: Write,
Expand Down
2 changes: 1 addition & 1 deletion src/archive/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ pub fn build_archive_from_paths<W>(
input_filenames: &[PathBuf],
output_path: &Path,
writer: W,
quiet: bool,
file_visibility_policy: FileVisibilityPolicy,
quiet: bool,
) -> crate::Result<W>
where
W: Write + Seek,
Expand Down
10 changes: 8 additions & 2 deletions src/commands/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn compress_files(
io::copy(&mut reader, &mut writer)?;
}
Tar => {
archive::tar::build_archive_from_paths(&files, output_path, &mut writer, quiet, file_visibility_policy)?;
archive::tar::build_archive_from_paths(&files, output_path, &mut writer, file_visibility_policy, quiet)?;
writer.flush()?;
}
Zip => {
Expand All @@ -89,7 +89,13 @@ pub fn compress_files(

let mut vec_buffer = Cursor::new(vec![]);

archive::zip::build_archive_from_paths(&files, output_path, &mut vec_buffer, quiet, file_visibility_policy)?;
archive::zip::build_archive_from_paths(
&files,
output_path,
&mut vec_buffer,
file_visibility_policy,
quiet,
)?;
vec_buffer.rewind()?;
io::copy(&mut vec_buffer, &mut writer)?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn decompress_file(
output_dir: &Path,
output_file_path: PathBuf,
question_policy: QuestionPolicy,
quiet: bool
quiet: bool,
) -> crate::Result<()> {
assert!(output_dir.exists());
let reader = fs::File::open(input_file_path)?;
Expand Down
9 changes: 8 additions & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,14 @@ pub fn run(

for ((input_path, formats), file_name) in files.iter().zip(formats).zip(output_paths) {
let output_file_path = output_dir.join(file_name); // Path used by single file format archives
decompress_file(input_path, formats, &output_dir, output_file_path, question_policy, args.quiet)?;
decompress_file(
input_path,
formats,
&output_dir,
output_file_path,
question_policy,
args.quiet,
)?;
}
}
Subcommand::List { archives: files, tree } => {
Expand Down

0 comments on commit 0ceb84d

Please sign in to comment.