9d8d4cf41482a95127ca41faecc0a7ee0781ca2e

Author
drjaska <88596812+drjaska@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(extract): support `.pk{3,4,7}` files (#13254)

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/extract/README.md b/plugins/extract/README.md
  2index e0f5715210960d369a890d55861140b01ce60cdd..7bedfb1c66346bf2dc4a5d67385e4ef71e39d4de 100644
  3--- a/plugins/extract/README.md
  4+++ b/plugins/extract/README.md
  5@@ -14,53 +14,56 @@ plugins=(... extract)
  6 
  7 ## Supported file extensions
  8 
  9-| Extension         | Description                          |
 10-| :---------------- | :----------------------------------- |
 11-| `7z`              | 7zip file                            |
 12-| `Z`               | Z archive (LZW)                      |
 13-| `apk`             | Android app file                     |
 14-| `aar`             | Android library file                 |
 15-| `bz2`             | Bzip2 file                           |
 16-| `cab`             | Microsoft cabinet archive            |
 17-| `cpio`            | Cpio archive                         |
 18-| `deb`             | Debian package                       |
 19-| `ear`             | Enterprise Application aRchive       |
 20-| `exe`             | Windows executable file              |
 21-| `gz`              | Gzip file                            |
 22-| `ipa`             | iOS app package                      |
 23-| `ipsw`            | iOS firmware file                    |
 24-| `jar`             | Java Archive                         |
 25-| `lrz`             | LRZ archive                          |
 26-| `lz4`             | LZ4 archive                          |
 27-| `lzma`            | LZMA archive                         |
 28-| `obscpio`         | cpio archive used on OBS             |
 29-| `rar`             | WinRAR archive                       |
 30-| `rpm`             | RPM package                          |
 31-| `sublime-package` | Sublime Text package                 |
 32-| `tar`             | Tarball                              |
 33-| `tar.bz2`         | Tarball with bzip2 compression       |
 34-| `tar.gz`          | Tarball with gzip compression        |
 35-| `tar.lrz`         | Tarball with lrzip compression       |
 36-| `tar.lz`          | Tarball with lzip compression        |
 37-| `tar.lz4`         | Tarball with lz4 compression         |
 38-| `tar.xz`          | Tarball with lzma2 compression       |
 39-| `tar.zma`         | Tarball with lzma compression        |
 40-| `tar.zst`         | Tarball with zstd compression        |
 41-| `tbz`             | Tarball with bzip compression        |
 42-| `tbz2`            | Tarball with bzip2 compression       |
 43-| `tgz`             | Tarball with gzip compression        |
 44-| `tlz`             | Tarball with lzma compression        |
 45-| `txz`             | Tarball with lzma2 compression       |
 46-| `tzst`            | Tarball with zstd compression        |
 47-| `vsix`            | VS Code extension zip file           |
 48-| `war`             | Web Application archive (Java-based) |
 49-| `whl`             | Python wheel file                    |
 50-| `xpi`             | Mozilla XPI module file              |
 51-| `xz`              | LZMA2 archive                        |
 52-| `zip`             | Zip archive                          |
 53-| `zlib`            | zlib archive                         |
 54-| `zst`             | Zstandard file (zstd)                |
 55-| `zpaq`            | Zpaq file                            |
 56+| Extension         | Description                             |
 57+| :---------------- | :-------------------------------------- |
 58+| `7z`              | 7zip file                               |
 59+| `apk`             | Android app file                        |
 60+| `aar`             | Android library file                    |
 61+| `bz2`             | Bzip2 file                              |
 62+| `cab`             | Microsoft cabinet archive               |
 63+| `cpio`            | Cpio archive                            |
 64+| `deb`             | Debian package                          |
 65+| `ear`             | Enterprise Application aRchive          |
 66+| `exe`             | Windows executable file                 |
 67+| `gz`              | Gzip file                               |
 68+| `ipa`             | iOS app package                         |
 69+| `ipsw`            | iOS firmware file                       |
 70+| `jar`             | Java Archive                            |
 71+| `lrz`             | LRZ archive                             |
 72+| `lz4`             | LZ4 archive                             |
 73+| `lzma`            | LZMA archive                            |
 74+| `obscpio`         | cpio archive used on OBS                |
 75+| `pk3`             | Renamed Zip archive used by Quake games |
 76+| `pk4`             | Renamed Zip archive used by Quake games |
 77+| `pk7`             | Renamed 7zip file used by Quake games   |
 78+| `rar`             | WinRAR archive                          |
 79+| `rpm`             | RPM package                             |
 80+| `sublime-package` | Sublime Text package                    |
 81+| `tar`             | Tarball                                 |
 82+| `tar.bz2`         | Tarball with bzip2 compression          |
 83+| `tar.gz`          | Tarball with gzip compression           |
 84+| `tar.lrz`         | Tarball with lrzip compression          |
 85+| `tar.lz`          | Tarball with lzip compression           |
 86+| `tar.lz4`         | Tarball with lz4 compression            |
 87+| `tar.xz`          | Tarball with lzma2 compression          |
 88+| `tar.zma`         | Tarball with lzma compression           |
 89+| `tar.zst`         | Tarball with zstd compression           |
 90+| `tbz`             | Tarball with bzip compression           |
 91+| `tbz2`            | Tarball with bzip2 compression          |
 92+| `tgz`             | Tarball with gzip compression           |
 93+| `tlz`             | Tarball with lzma compression           |
 94+| `txz`             | Tarball with lzma2 compression          |
 95+| `tzst`            | Tarball with zstd compression           |
 96+| `vsix`            | VS Code extension zip file              |
 97+| `war`             | Web Application archive (Java-based)    |
 98+| `whl`             | Python wheel file                       |
 99+| `xpi`             | Mozilla XPI module file                 |
100+| `xz`              | LZMA2 archive                           |
101+| `Z`               | Z archive (LZW)                         |
102+| `zip`             | Zip archive                             |
103+| `zlib`            | zlib archive                            |
104+| `zst`             | Zstandard file (zstd)                   |
105diff --git a/plugins/extract/_extract b/plugins/extract/_extract
106index 0b43e86bcc072727bca3c73b29a1e715d4bcfc60..6641443d3281ef8f13339fd028218a9b6426b607 100644
107--- a/plugins/extract/_extract
108+++ b/plugins/extract/_extract
109@@ -19,6 +19,9 @@ local -a exts=(
110   lz4
111   lzma
112   obscpio
113+  pk3
114+  pk4
115+  pk7
116   rar
117   rpm
118   sublime-package
119diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
120index aa3fd00e6e6ba668069bce5cdc1e1f43205d35fd..d8cbc8b945ef66c54f8c1127ad4fa3d7bfdb2793 100644
121--- a/plugins/extract/extract.plugin.zsh
122+++ b/plugins/extract/extract.plugin.zsh
123@@ -76,11 +76,11 @@ EOF
124       (*.lz4) lz4 -d "$full_path" ;;
125       (*.lzma) unlzma "$full_path" ;;
126       (*.z) uncompress "$full_path" ;;
127-      (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx) unzip "$full_path" ;;
128+      (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
129       (*.rar) unrar x -ad "$full_path" ;;
130       (*.rpm)
131         rpm2cpio "$full_path" | cpio --quiet -id ;;
132-      (*.7z | *.7z.[0-9]*) 7za x "$full_path" ;;
133+      (*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
134       (*.deb)
135         command mkdir -p "control" "data"
136         ar vx "$full_path" > /dev/null