94 Commits

Author SHA1 Message Date
ttyS3
e1d7f1424a refactor: improve code formatting in mod.rs and logger.rs 2024-12-14 19:52:32 -03:00
ttyS3
77b01d170f refactor(cli): move thread pool setup to command execution, use thread::spawn instead of rayon::spawn in the logger thread 2024-12-14 19:52:32 -03:00
ttyS3
22d4e0faf0 chore: add comments about RAR 4.x and 5.0 signature 2024-12-02 12:34:48 -03:00
João Marcos P. Bezerra
3e890eb307 chore: rename functions and fix wrong logs 2024-11-20 03:32:20 -03:00
João Marcos P. Bezerra
cc530bea94 refac: simplify logger shutdown system 2024-11-20 03:32:20 -03:00
João Marcos P. Bezerra
df6d2cea98 tweak: don't add period to end of each log 2024-11-18 00:32:17 -03:00
João Marcos P. Bezerra
60d5897de1 fix: don't shutdown logger after flush 2024-11-17 23:52:39 -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
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
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
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
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
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
615a7d3c49 logger: flush logs temporarily 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
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
João Marcos P. Bezerra
bed8ea0276 create Logger::info_accessible 2024-04-01 10:58:35 -03:00
Antonios Barotsis
1e56bb8f1f Improve logging interface 2024-04-01 10:58:35 -03:00
Antonios Barotsis
380893b6df Add levels and fix output 2024-04-01 10:58:35 -03:00
Antonios Barotsis
e2ac5c4c9b Make all info logs use the new system 2024-04-01 10:58:35 -03:00
Antonios Barotsis
e989db7a3a Added buffering 2024-04-01 10:58:35 -03:00
Antonios Barotsis
c2873f77d3 wip 2024-04-01 10:58:35 -03:00
misilelab
db0bc8a7d9 impl except test 2023-11-25 21:33:22 -03:00
Łukasz Krawiec
dade163243 added support for listing and decompressing .rar archives 2023-11-15 08:59:00 -03:00
João Marcos
9507c4d93a
Merge pull request #502 from ouch-org/fix-size-unit-inconsistency
Fix size unit inconsistency
2023-09-07 16:12:20 -03:00
João M. Bezerra
c32cbd8c7b fix clippy warning 2023-09-04 21:49:42 -03:00
João M. Bezerra
cbd327aad7 replace usage of ubyte by our own Bytes formatter 2023-09-04 21:15:57 -03:00
João M. Bezerra
693167e933 formatting: fix gibibytes vs gigabytes issue 2023-09-04 20:54:49 -03:00
João M. Bezerra
76116ed5ec re-add our size unit code from 368a776 2023-09-04 20:40:00 -03:00
João M. Bezerra
54ee52610a fix rustdoc warnings 2023-02-03 02:24:07 -03:00
figsoda
e06b2c8635 apply clippy suggestions 2023-01-05 14:23:37 -05:00
Vinícius R. Miguel
2caeb1004c refac: add support for Windows in EscapedPathDisplay 2023-01-05 13:39:06 -03:00
Vinícius R. Miguel
0deb18289a refac: use BStr to display possibly non-UTF8 byte sequences 2023-01-05 12:46:29 -03:00
João M. Bezerra
c737956a4e check for EOF when asking questions
when invoking Ouch from shell scripts, it is likely that questions will
be left unanswered with EOF, this commit fixes Ouch interpreting EOF as
Yes in Y/N questions
2022-11-23 00:43:53 -03:00
João M. Bezerra
e8d0914a01 improve error message when compressing folder with single-file formats 2022-10-17 00:03:44 -03:00
figsoda
13fab6d241 remove progress feature 2022-10-15 23:03:20 -04:00
João M. Bezerra
9f7cba79e1 use remove_file_or_dir to remove dir check 2022-10-15 22:31:47 -03:00
João M. Bezerra
2da497c1ca fix fatal error if read fails when compressing 2022-10-15 22:01:30 -03:00
João M. Bezerra
4d2ccf4873 create remove_file_or_dir util 2022-10-15 21:51:52 -03:00
João M. Bezerra
cdd1b530be fix not overwriting a folder when compressing 2022-10-15 21:36:24 -03:00
figsoda
d4766c4bf3
Merge branch 'main' into rewrite-progress 2022-10-13 11:37:09 -04:00
figsoda
51855948f1 add OutputLine trait for performance improvements 2022-10-13 11:31:43 -04:00
figsoda
2f4404e658 use humansize instead of Bytes 2022-10-12 22:33:41 -04:00
João M. Bezerra
a2c91c4248 minor tweaks 2022-10-11 22:09:39 -03:00