b06663df23b2910a6e542dc114dc7adc2cdce22f

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(extract): add support for `.zlib` and `.exe` files (#11085)

Fixes #11085

Diff

 1diff --git a/plugins/extract/README.md b/plugins/extract/README.md
 2index ac4a8e19717ab49c37d57988c67bde16bd6ea7f7..c8d98b2298e3b4350e4663a18c6c2a294bc5c198 100644
 3--- a/plugins/extract/README.md
 4+++ b/plugins/extract/README.md
 5@@ -25,6 +25,7 @@ plugins=(... extract)
 6 | `cpio`            | Cpio archive                         |
 7 | `deb`             | Debian package                       |
 8 | `ear`             | Enterprise Application aRchive       |
 9+| `exe`             | Windows executable file              |
10 | `gz`              | Gzip file                            |
11 | `ipa`             | iOS app package                      |
12 | `ipsw`            | iOS firmware file                    |
13@@ -52,9 +53,11 @@ plugins=(... extract)
14 | `txz`             | Tarball with lzma2 compression       |
15 | `tzst`            | Tarball with zstd compression        |
16 | `war`             | Web Application archive (Java-based) |
17+| `whl`             | Python wheel file                    |
18 | `xpi`             | Mozilla XPI module file              |
19 | `xz`              | LZMA2 archive                        |
20 | `zip`             | Zip archive                          |
21+| `zlib`            | zlib archive                         |
22 | `zst`             | Zstandard file (zstd)                |
23 | `zpaq`            | Zpaq file                            |
24 
25diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
26index ee1d38b3f04f99d1e8c981d9637c652ca1c5c8c3..b7a823c9fdb77d73ead567d526609835de520ce5 100644
27--- a/plugins/extract/extract.plugin.zsh
28+++ b/plugins/extract/extract.plugin.zsh
29@@ -83,9 +83,10 @@ EOF
30         builtin cd -q ../data; extract ../data.tar.*
31         builtin cd -q ..; command rm *.tar.* debian-binary ;;
32       (*.zst) unzstd "$full_path" ;;
33-      (*.cab) cabextract "$full_path" ;;
34+      (*.cab|*.exe) cabextract "$full_path" ;;
35       (*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
36       (*.zpaq) zpaq x "$full_path" ;;
37+      (*.zlib) zlib-flate -uncompress < "$full_path" > "${file:r}" ;;
38       (*)
39         echo "extract: '$file' cannot be extracted" >&2
40         success=1 ;;