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
Ohmyzsh
Commits
6dc937ff
Unverified
Commit
6dc937ff
authored
Aug 04, 2021
by
Marc Cornellà
Browse files
feat(extract): add suport for .cab files via `cabextract`
parent
af6c7f3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
plugins/extract/README.md
View file @
6dc937ff
...
@@ -21,6 +21,7 @@ plugins=(... extract)
...
@@ -21,6 +21,7 @@ plugins=(... extract)
|
`apk`
| Android app file |
|
`apk`
| Android app file |
|
`aar`
| Android library file |
|
`aar`
| Android library file |
|
`bz2`
| Bzip2 file |
|
`bz2`
| Bzip2 file |
|
`cab`
| Microsoft cabinet archive |
|
`deb`
| Debian package |
|
`deb`
| Debian package |
|
`ear`
| Enterprise Application aRchive |
|
`ear`
| Enterprise Application aRchive |
|
`gz`
| Gzip file |
|
`gz`
| Gzip file |
...
...
plugins/extract/_extract
View file @
6dc937ff
...
@@ -3,5 +3,5 @@
...
@@ -3,5 +3,5 @@
_arguments \
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|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|
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)(-.)'" \
&& return 0
&& return 0
plugins/extract/extract.plugin.zsh
View file @
6dc937ff
...
@@ -55,7 +55,7 @@ extract() {
...
@@ -55,7 +55,7 @@ extract() {
(
*
.lz4
)
lz4
-d
"
$1
"
;;
(
*
.lz4
)
lz4
-d
"
$1
"
;;
(
*
.lzma
)
unlzma
"
$1
"
;;
(
*
.lzma
)
unlzma
"
$1
"
;;
(
*
.z
)
uncompress
"
$1
"
;;
(
*
.z
)
uncompress
"
$1
"
;;
(
*
.zip|
*
.war|
*
.jar|
*
.ear|
*
.sublime-package|
*
.ipa|
*
.ipsw|
*
.xpi|
*
.apk|
*
.aar|
*
.whl
)
unzip
"
$1
"
-d
$extract_dir
;;
(
*
.zip|
*
.war|
*
.jar|
*
.ear|
*
.sublime-package|
*
.ipa|
*
.ipsw|
*
.xpi|
*
.apk|
*
.aar|
*
.whl
)
unzip
"
$1
"
-d
"
$extract_dir
"
;;
(
*
.rar
)
unrar x
-ad
"
$1
"
;;
(
*
.rar
)
unrar x
-ad
"
$1
"
;;
(
*
.rpm
)
mkdir
"
$extract_dir
"
&&
cd
"
$extract_dir
"
&&
rpm2cpio
"../
$1
"
| cpio
--quiet
-id
&&
cd
..
;;
(
*
.rpm
)
mkdir
"
$extract_dir
"
&&
cd
"
$extract_dir
"
&&
rpm2cpio
"../
$1
"
| cpio
--quiet
-id
&&
cd
..
;;
(
*
.7z
)
7za x
"
$1
"
;;
(
*
.7z
)
7za x
"
$1
"
;;
...
@@ -69,6 +69,7 @@ extract() {
...
@@ -69,6 +69,7 @@ extract() {
cd
..
cd
..
;;
;;
(
*
.zst
)
unzstd
"
$1
"
;;
(
*
.zst
)
unzstd
"
$1
"
;;
(
*
.cab
)
cabextract
-d
"
$extract_dir
"
"
$1
"
;;
(
*
)
(
*
)
echo
"extract: '
$1
' cannot be extracted"
>
&2
echo
"extract: '
$1
' cannot be extracted"
>
&2
success
=
1
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