summaryrefslogtreecommitdiff
path: root/plugins/extract
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-01-02 15:46:19 -0500
committerTuowen Zhao <ztuowen@gmail.com>2020-01-02 15:46:19 -0500
commitff9208623b3573c736ae9118947aaf0c7e752998 (patch)
tree45977b00446155003d486c04c3b891a5b7c88441 /plugins/extract
parent1456610ebd292625fdc34fa3167c9c0f67d85228 (diff)
parentca627655dbd1d110dbea34ec4a8c1964a1da83d2 (diff)
downloadzsh-ff9208623b3573c736ae9118947aaf0c7e752998.tar.gz
zsh-ff9208623b3573c736ae9118947aaf0c7e752998.tar.bz2
zsh-ff9208623b3573c736ae9118947aaf0c7e752998.zip
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins/extract')
-rw-r--r--plugins/extract/README.md6
-rw-r--r--plugins/extract/_extract2
-rw-r--r--plugins/extract/extract.plugin.zsh8
3 files changed, 15 insertions, 1 deletions
diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index 41b6a61f1..a6630de3f 100644
--- a/plugins/extract/README.md
+++ b/plugins/extract/README.md
@@ -25,6 +25,7 @@ plugins=(... extract)
| `gz` | Gzip file |
| `ipsw` | iOS firmware file |
| `jar` | Java Archive |
+| `lrz` | LRZ archive |
| `lzma` | LZMA archive |
| `rar` | WinRAR archive |
| `rpm` | RPM package |
@@ -32,17 +33,22 @@ plugins=(... extract)
| `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression |
| `tar.gz` | Tarball with gzip compression |
+| `tar.lrz` | Tarball with lrzip compression |
+| `tar.lz` | Tarball with lzip compression |
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
+| `tar.zst` | Tarball with zstd compression |
| `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression |
| `tlz` | Tarball with lzma compression |
| `txz` | Tarball with lzma2 compression |
+| `tzst` | Tarball with zstd compression |
| `war` | Web Application archive (Java-based) |
| `xpi` | Mozilla XPI module file |
| `xz` | LZMA2 archive |
| `zip` | Zip archive |
+| `zst` | Zstandard file (zstd) |
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 0257ce231..034fe6df0 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|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
+ "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lrz|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 27b9e50f1..349c9a776 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -40,10 +40,17 @@ extract() {
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
+ (*.tar.zst|*.tzst)
+ tar --zstd --help &> /dev/null \
+ && tar --zstd -xvf "$1" \
+ || zstdcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
+ (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
+ (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
+ (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
@@ -59,6 +66,7 @@ extract() {
cd ..; rm *.tar.* debian-binary
cd ..
;;
+ (*.zst) unzstd "$1" ;;
(*)
echo "extract: '$1' cannot be extracted" >&2
success=1