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

Improve error message description when trying to compress a folder with a multiple single file formats #268

Closed
marcospb19 opened this issue Aug 17, 2022 · 1 comment · Fixed by #303
Labels
bug Something isn't working

Comments

@marcospb19
Copy link
Member

Version

e377dd3 (latest)

Description

Ouch is not giving a correct error message when trying to compress a folder with multiple single formats:

$ ouch compress linux.pkg linux.xz.gz.zst

Current Behavior

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/commands/mod.rs:102:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected Behavior

Something like this, when we just pass ".xz".

$ ouch compress linux-5.17.5.arch1-1-x86_64.pkg linux.xz
[ERROR] Cannot compress to 'linux.xz'.
 - You are trying to compress multiple files.
 - The compression format 'xz' 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 'xz'.
hint: From: linux.xz
hint: To:   linux.tar.xz

Additional Information

It would be beneficial, while solving this, to write integration tests that check what is the output given.

@marcospb19
Copy link
Member Author

This is still not working properly:

ouch c empty-folder/ a.gz
[ERROR] failed to read from file `/home/marcospb19/ouch/empty-folder`

I think I have detected where the problem is tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant