mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Fix single format compression (#89)
Now working for formats that are not archives, like file.gz and file.xz
This commit is contained in:
parent
1c24f41494
commit
c89c34a91f
@ -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)))
|
.hint(format!("Otherwise, remove the last '{}' from '{}'.", format, to_utf(&output_path)))
|
||||||
.clone();
|
.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)? {
|
if output_path.exists() && !utils::user_wants_to_overwrite(&output_path, flags)? {
|
||||||
@ -169,7 +169,7 @@ fn compress_files(
|
|||||||
) -> crate::Result<()> {
|
) -> crate::Result<()> {
|
||||||
let file_writer = BufWriter::with_capacity(BUFFER_CAPACITY, output_file);
|
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] {
|
match formats[0] {
|
||||||
Tar => {
|
Tar => {
|
||||||
let mut bufwriter = archive::tar::build_archive_from_paths(&files, file_writer)?;
|
let mut bufwriter = archive::tar::build_archive_from_paths(&files, file_writer)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user