ouch icon indicating copy to clipboard operation
ouch copied to clipboard

Support `.7z`

Open BLucky-gh opened this issue 3 years ago • 3 comments

The title sums up the first part of the request pretty well, 7z is a pretty popular archive format, but 7z supports several different compression formats it supports, so I think it would also be good to add an option like --format/-f to specify a compression format independently of the file name, which would be useful in general too

BLucky-gh avatar Nov 04 '21 14:11 BLucky-gh

About --format, it's related to #134.

(I think this issue can focus more on 7z.)

marcospb19 avatar Nov 04 '21 21:11 marcospb19

The only crate I found is https://lib.rs/crates/rust7z, docs are failing and seems unmaintained https://lib.rs/crates/lzma-rs does say it might also implement 7z in the future, its something we can wait for otherwise we would have to implement it ourselves using some lzma crate

figsoda avatar Nov 06 '21 16:11 figsoda

I'd rather wait for other crates than implement it by ourselves (unless someone gets really interested in doing so...), Rust ecosystem is always growing, so I bet that someone will do it (from scratch or by fixing existing crates).

Will keep this open indefinitely, in hope it will become possible.

marcospb19 avatar Nov 10 '21 09:11 marcospb19

https://crates.io/crates/sevenz-rust may be worth watching. Doesn't look like it supports compression yet.

siph avatar Oct 12 '22 12:10 siph

Can you not maybe rely upon and call out to the 7z/7z.exe shell command for 7z functionality perhaps? I believe 7z also supports RAR archives as well, so that would give you a free solution to the "Support RAR" issue request as well, I think. Or is that sorta thing not very convenient to do from Rust? (I'ma Python guy, so I'm afraid I know little about Rust beyond how to build / install existing Rust apps. On Python, I use the subprocess library to call shell commands. I just kinda assumed most modern languages have similar functionality available.)

blooalien avatar Jan 25 '23 08:01 blooalien

Calling a binary works, but it can make shipping more difficult, currently Ouch does not require any other binary to be installed, but there are a couple of alternative tools that approach it this way. We'd need to put this as a dependency, but then Ouch wouldn't be shippable to something that 7z isn't shipped too.

Invoking a binary also runs into some other problems I explained in finer detail at #152, regarding stream encoding and decoding, and also error handling, I think that error treatment in Ouch is very satisfactory, we can generate a custom message for almost all steps.

When I consider all of these I'd say it's not worth it, but it's open for discussion, we might want to take the trade-offs and additional implementation trouble.

marcospb19 avatar Jan 25 '23 18:01 marcospb19

https://crates.io/crates/sevenz-rust supports compression since version 0.2.0.

Aziks0 avatar Feb 23 '23 11:02 Aziks0

@Aziks0 thanks for pointing this out, I labeled this issue as "good first issue" in case someone wants to take it.

marcospb19 avatar Feb 23 '23 16:02 marcospb19