summaryrefslogtreecommitdiff
path: root/plugins/extract
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/extract')
-rw-r--r--plugins/extract/README.md16
-rw-r--r--plugins/extract/_extract2
-rw-r--r--plugins/extract/extract.plugin.zsh3
3 files changed, 12 insertions, 9 deletions
diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index 44f0b05a1..ac4a8e197 100644
--- a/plugins/extract/README.md
+++ b/plugins/extract/README.md
@@ -1,10 +1,10 @@
# extract plugin
-This plugin defines a function called `extract` that extracts the archive file
-you pass it, and it supports a wide variety of archive filetypes.
+This plugin defines a function called `extract` that extracts the archive file you pass it, and it supports a
+wide variety of archive filetypes.
-This way you don't have to know what specific command extracts a file, you just
-do `extract <filename>` and the function takes care of the rest.
+This way you don't have to know what specific command extracts a file, you just do `extract <filename>` and
+the function takes care of the rest.
To use it, add `extract` to the plugins array in your zshrc file:
@@ -15,7 +15,7 @@ plugins=(... extract)
## Supported file extensions
| Extension | Description |
-|:------------------|:-------------------------------------|
+| :---------------- | :----------------------------------- |
| `7z` | 7zip file |
| `Z` | Z archive (LZW) |
| `apk` | Android app file |
@@ -32,6 +32,7 @@ plugins=(... extract)
| `lrz` | LRZ archive |
| `lz4` | LZ4 archive |
| `lzma` | LZMA archive |
+| `obscpio` | cpio archive used on OBS |
| `rar` | WinRAR archive |
| `rpm` | RPM package |
| `sublime-package` | Sublime Text package |
@@ -55,6 +56,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.
+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 27b099c9e..56b17058f 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|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)(-.)'" \
&& return 0
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 563d88c72..7b7a2fa4f 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -72,7 +72,8 @@ EOF
builtin cd -q ..; command rm *.tar.* debian-binary ;;
(*.zst) unzstd "$file" ;;
(*.cab) cabextract -d "$extract_dir" "$file" ;;
- (*.cpio) cpio -idmvF "$file" ;;
+ (*.cpio|*.obscpio) cpio -idmvF "$file" ;;
+ (*.zpaq) zpaq x "$file" ;;
(*)
echo "extract: '$file' cannot be extracted" >&2
success=1 ;;