From e50dd3417c8b9e072593b6c14473e1360bd88b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 5 Sep 2024 12:07:18 +0200 Subject: [PATCH] feat(extract): add support for `.crx` (Chrome extension format) (#12652) --- plugins/extract/_extract | 49 +++++++++++++++++++++++++++++- plugins/extract/extract.plugin.zsh | 2 +- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 56b17058f..0b43e86bc 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -1,7 +1,54 @@ #compdef extract #autoload +local -a exts=( + 7z + aar + apk + bz2 + cab + cpio + crx + deb + ear + gz + ipa + ipsw + jar + lrz + lz4 + lzma + obscpio + 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 + vsix + war + whl + xpi + xz + Z + zip + zpaq + zst +) + _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|obscpio|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)(-.)'" \ + "*::archive file:_files -g '(#i)*.(${(j:|:)exts})(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index f2eebf4d6..aa3fd00e6 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -76,7 +76,7 @@ EOF (*.lz4) lz4 -d "$full_path" ;; (*.lzma) unlzma "$full_path" ;; (*.z) uncompress "$full_path" ;; - (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix) unzip "$full_path" ;; + (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx) unzip "$full_path" ;; (*.rar) unrar x -ad "$full_path" ;; (*.rpm) rpm2cpio "$full_path" | cpio --quiet -id ;;