From 9b91e8256011240cbf65ba65fbe55c5fd9dbae07 Mon Sep 17 00:00:00 2001
From: david <chxei5667@gmail.com>
Date: Sun, 5 Feb 2023 11:32:49 +0400
Subject: [PATCH] feat(extract): add `zpaq` support (#11478)

---
 plugins/extract/README.md          | 1 +
 plugins/extract/_extract           | 2 +-
 plugins/extract/extract.plugin.zsh | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index 44f0b05a..f67b5361 100644
--- a/plugins/extract/README.md
+++ b/plugins/extract/README.md
@@ -55,6 +55,7 @@ plugins=(... extract)
 | `xz`              | LZMA2 archive                        |
 | `zip`             | Zip archive                          |
 | `zst`             | Zstandard file (zstd)                |
+| `zpaq`            | Zpaq file                            |
 
 See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
 more information regarding archive formats.
diff --git a/plugins/extract/_extract b/plugins/extract/_extract
index 27b099c9..64678fed 100644
--- a/plugins/extract/_extract
+++ b/plugins/extract/_extract
@@ -3,5 +3,5 @@
 
 _arguments \
   '(-r --remove)'{-r,--remove}'[Remove archive.]' \
-  "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
+  "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
     && return 0
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 563d88c7..4c84ef88 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -73,6 +73,7 @@ EOF
       (*.zst) unzstd "$file" ;;
       (*.cab) cabextract -d "$extract_dir" "$file" ;;
       (*.cpio) cpio -idmvF "$file" ;;
+      (*.zpaq) zpaq x "$file" ;;
       (*)
         echo "extract: '$file' cannot be extracted" >&2
         success=1 ;;