558 Commits

Author SHA1 Message Date
João Marcos P. Bezerra
b21b757af1 chore: improve log message 2024-11-17 23:49:31 -03:00
João Marcos P. Bezerra
065124cd30 tweak: improve error message
in case the user is trying to decompress a file with no filestem, just
the extension, which is confusing
2024-11-17 23:49:18 -03:00
João Marcos P. Bezerra
4bb759b21c tweak: improve error message
in case the user is trying to decompress a file with no filestem, just
the extension, which is confusing
2024-11-17 23:47:24 -03:00
João Marcos P. Bezerra
5b78b96fa1 fix: warnings not shown before stdin interaction 2024-11-17 23:47:11 -03:00
João Marcos P. Bezerra
639ef19fbc chore: simplify code after feature stabilization
no need to reimplement `Path::is_symlink` anymore
2024-11-17 21:21:58 -03:00
João M. Bezerra
8edd8d2e1c Replace .unwrap()s by ? 2024-11-17 14:50:02 -03:00
Jonas Frei
32b50e9c7a Added test code, handled BlockSize error, block size = 16MiB
Signed-off-by: Jonas Frei <freijon@pm.me>
2024-11-17 14:50:02 -03:00
Jonas Frei
ba9f9c00f3 Add support for bzip3
Closes #398
Signed-off-by: Jonas Frei <freijon@pm.me>
2024-11-17 14:50:02 -03:00
valoq
e2151c93d5 fix format to appease linter 2024-10-22 00:00:19 -03:00
valoq
83f28cf64a change temporary path to a more unique name 2024-10-22 00:00:19 -03:00
João M. Bezerra
5dac8431f2 Fix --format parsing extensions with dots
Also improve error reporting for `--format` with malformed or
unsupported extensions

This commit is very messy, as it also does an refac in the project,
which should ideally be in a separated commit
2024-09-07 00:24:50 -03:00
João M. Bezerra
1a80b919e3 Add tests to the extension module 2024-09-07 00:24:50 -03:00
ttyS3
a3d4f6ac6b fix: simplify error handling for invalid password 2024-09-06 21:47:03 -03:00
ttyS3
c3e37e22d1 refactor(rar): simplify list_archive logic and remove UnrarError
Simplify the list_archive function by combining archive creation and listing steps.
Remove the UnrarError variant from the Error enum as it's no longer used.
2024-09-06 21:47:03 -03:00
ttyS3
f8f1439ec5 style: cargo fmt 2024-09-06 21:47:03 -03:00
ttyS3
84f1ec4daf refactor(zip): remove redundant password byte conversion
Simplify password handling by removing platform-specific code and utilizing ByteSlice for all conversions.
2024-09-06 21:47:03 -03:00
ttyS3
56f69e19a3 fix(archive): return result in list_archive functions 2024-09-06 21:47:03 -03:00
ttyS3
39cef75dfe fix(error): return result in list_archive
Refactor list_archive functions to return results directly for better error handling.
2024-09-06 21:47:03 -03:00
ttyS3
9e1c30bb86 fix(archive): handle mangled zip file names properly
Replace enclosed_name with mangled_name fallback for robustness.
2024-09-06 21:47:03 -03:00
ttyS3
9c69fbd911 fix: replace UnsupportedFormat error with UnrarError
Update error handling for unrar-specific issues to use the new UnrarError type.
2024-09-06 21:47:03 -03:00
ttyS3
7e830d9f53 fix(archive): handle errors for unsupported formats
Handle errors for unsupported formats in RAR and 7z archives by returning appropriate error messages.
2024-09-06 21:47:03 -03:00
ttyS3
bafbd83bd7 fix(archive): handle file open error in list_archive method 2024-09-06 21:47:03 -03:00
ttyS3
08ab63837e fix(archive): handle invalid UTF-8 passwords in 7z decompression 2024-09-06 21:47:03 -03:00
ttyS3
67ca183a25 fix: fix windows build 2024-09-06 21:47:03 -03:00
ttyS3
61868dfb56 fix: remove unnecessary clones in zip decryption 2024-09-06 21:47:03 -03:00
ttyS3
309d165606 fix(archive): replace unwrap with error handling in zip.rs 2024-09-06 21:47:03 -03:00
ttyS3
2dad11d0ba fix(password): update password handling for archives
Refactor password handling in archive functions to use &[u8] instead of impl AsRef<[u8]>. Include better error reporting for invalid UTF-8 passwords in 7z archives.
2024-09-06 21:47:03 -03:00
ttyS3
9b092fef71 style: cargo fmt 2024-09-06 21:47:03 -03:00
ttyS3
8987992c21 chore: fix tests 2024-09-06 21:47:03 -03:00
ttyS3
3392730d66 style: lint the code 2024-09-06 21:47:03 -03:00
ttyS3
d21db763f1 feat: support decompress and list zip file 2024-09-06 21:47:03 -03:00
ttyS3
75e16510df feat(list): support list and decompress 7z files with password 2024-09-06 21:47:03 -03:00
ttyS3
512d2445b2 feat: add password support for decompress and list 2024-09-06 21:47:03 -03:00
Ryan Roden-Corrent
61f96cab13 Fix docstring formatting for clippy.
Fixes:

```
error: doc list item missing indentation
   --> src/commands/decompress.rs:237:5
    |
237 | /// Note: This functions assumes that `output_dir` exists
    |     ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
    = note: `-D clippy::doc-lazy-continuation` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::doc_lazy_continuation)]`
help: indent this line
    |
237 | ///   Note: This functions assumes that `output_dir` exists
    |     ++
```
2024-08-26 03:40:52 -03:00
Ryan Roden-Corrent
a7fe78fc68 Write decompressed stdin to stdin-output. 2024-08-26 03:40:52 -03:00
Ryan Roden-Corrent
77c1a4e9db Support decompressing stdin.
Fixes #687.

If "-" is passed as a filename, decompress data from stdin.

Currently `--format` must be passed as well, but as a next step,
we could try to infer the format from magic numbers.

As stdin is not connected to the terminal, we cannot prompt for Y/N
when warning about decompression in memory, for e.g. zip. Just default
to No, and require passing "-y" in these cases.

For zip, we have to buffer the whole stream in memory to seek into it,
just as we do with a chained decoder like `.zip.bz`.

The rar format requires an actual file (not an `impl Read`), so
we write a temp file that it can decode.

When decoding a single-file archive (e.g. file.bz), the output filename
is just `-`, since we don't know the original filename. I had to add
a bit of a hack to the tests to work around this. Another option
would be to interpret "-d" as a destination filename in this case.

When decoding a multi-file archive, I decided to unpack directly into
the destination directory, as this seemed like a better experience than
adding a top-level "-" folder inside the destination.
2024-08-26 03:40:52 -03:00
nalabrie
3867fa33e9 adjust README to indicate zstd runs in parallel, remove leftover code comment 2024-07-27 01:07:23 -03:00
nalabrie
0ec7d4489d Added multithreading by default to zstd compression. Bumped zstd package version. Added num_cpus package to get core count. 2024-07-27 01:07:23 -03:00
Antonios Barotsis
a14bbfc904 Switched to explicit shutdown message instead of None 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
a3e5bac438 fix STDIN syncrhonization problems 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
ccbdceac34 logger: fix warning output 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
62d70225ab remove macros.rs module 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
615a7d3c49 logger: flush logs temporarily 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
c56978d1e7 handle logger thread in main function 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
25d7d3d870 logger: refactor usage of sync primitives
use `std::sync::Barrier` instead of the barebones `Condvar` + `Mutex`
combo
2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
792db000bb move spawn_logger_thread to logger module
and create another module inside of the logger module to reorganize
things
2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
0b760aadf7 fix logger thread shutdown system 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
39395c797a move code to function run_cmd 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
d0280f0579 move code to function spawn_logger_thread 2024-04-01 10:58:35 -03:00
João Marcos P. Bezerra
28daa9e8c4 make logger channel static 2024-04-01 10:58:35 -03:00