From 937ac7596bc49f88955eecf9b4cbea57440a1833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Bezerra?= Date: Thu, 14 Oct 2021 17:34:57 -0300 Subject: [PATCH] Fix single format compression Now working for formats that are not archives, like file.gz and file.xz --- src/commands.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 0850039..05db7a6 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -93,7 +93,7 @@ pub fn run(command: Command, flags: &oof::Flags) -> crate::Result<()> { .hint(format!("Otherwise, remove the last '{}' from '{}'.", format, to_utf(&output_path))) .clone(); - return Err(Error::with_reason(reason)); + return Err(Error::with_reason(reason)); } if output_path.exists() && !utils::user_wants_to_overwrite(&output_path, flags)? { @@ -169,7 +169,7 @@ fn compress_files( ) -> crate::Result<()> { let file_writer = BufWriter::with_capacity(BUFFER_CAPACITY, output_file); - if formats.len() == 1 { + if let [Tar | Tgz | Zip] = *formats.as_slice() { match formats[0] { Tar => { let mut bufwriter = archive::tar::build_archive_from_paths(&files, file_writer)?;