Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
1761685d
Commit
1761685d
authored
Dec 17, 2019
by
Filipe Nascimento
Committed by
Marc Cornellà
Dec 17, 2019
Browse files
extract: add zstd support (#8469)
parent
664664f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
plugins/extract/README.md
View file @
1761685d
...
...
@@ -34,15 +34,18 @@ plugins=(... extract)
|
`tar.gz`
| Tarball with gzip 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.
plugins/extract/_extract
View file @
1761685d
...
...
@@ -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|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|
tar.zst|
tbz|tbz2|tgz|tlz|txz|
tzst|
war|whl|xpi|xz|zip
|zst
)(-.)'" \
&& return 0
plugins/extract/extract.plugin.zsh
View file @
1761685d
...
...
@@ -40,6 +40,10 @@ 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
"
;;
(
*
.gz
)
((
$+
commands[pigz]
))
&&
pigz
-dk
"
$1
"
||
gunzip
-k
"
$1
"
;;
(
*
.bz2
)
bunzip2
"
$1
"
;;
...
...
@@ -59,6 +63,7 @@ extract() {
cd
..
;
rm
*
.tar.
*
debian-binary
cd
..
;;
(
*
.zst
)
unzstd
"
$1
"
;;
(
*
)
echo
"extract: '
$1
' cannot be extracted"
>
&2
success
=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment