Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if a folder is being compressed to a non-archive format #79

Merged
merged 1 commit into from
Oct 7, 2021

Conversation

vrmiguel
Copy link
Member

@vrmiguel vrmiguel commented Oct 7, 2021

Closes #78

The previous check already worked well when more than a path was supplied to a non-archive method. However, passing a single directory trips this check and results into a panic. This PR aims to solve that.

@vrmiguel vrmiguel added wip This pull request is a work in progress and removed wip This pull request is a work in progress labels Oct 7, 2021
Comment on lines +156 to +161
Error::UnknownExtensionError(_) => todo!(),
Error::AlreadyExists => todo!(),
Error::InvalidZipArchive(_) => todo!(),
Error::PermissionDenied => todo!(),
Error::UnsupportedZipArchive(_) => todo!(),
Error::Custom { reason } => reason.clone(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Collaborator

@GabrielSimonetto GabrielSimonetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

$ cargo run c test_dirs/ t.bz
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/ouch c test_dirs/ t.bz`
[ERROR] Cannot compress to 't.bz'.
 - You are trying to compress multiple files.
 - The compression format '.bz' cannot receive multiple files.
 - The only supported formats that archive files into an archive are .tar and .zip.

hint: Try inserting '.tar' or '.zip' before '.bz'.
hint: From: t.bz
hint:  To : t.tar.bz

@vrmiguel vrmiguel merged commit 14961be into master Oct 7, 2021
@vrmiguel vrmiguel deleted the compressing-to-non-archive-format branch October 7, 2021 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proper error message when adding several files to a non-archive format such as bzip or gzip
2 participants