summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorFilippo Bonazzi <filippo.bonazzi@suse.com>2023-02-22 10:16:28 +0100
committerGitHub <noreply@github.com>2023-02-22 10:16:28 +0100
commita4f08ad238dba23a68df2a89b8fd47b8a9d26b0e (patch)
treefc5fa08d5a4f45200a0d65537ef77b0685ce747d /plugins
parent9f9d3b7d247b3c3e21542abaaf107e3d15aac1a5 (diff)
downloadzsh-a4f08ad238dba23a68df2a89b8fd47b8a9d26b0e.tar.gz
zsh-a4f08ad238dba23a68df2a89b8fd47b8a9d26b0e.tar.bz2
zsh-a4f08ad238dba23a68df2a89b8fd47b8a9d26b0e.zip
feat(extract): support `obscpio` format (#11511)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/extract/README.md15
-rw-r--r--plugins/extract/_extract2
-rw-r--r--plugins/extract/extract.plugin.zsh2
3 files changed, 10 insertions, 9 deletions
diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index f67b53618..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 |
@@ -57,5 +58,5 @@ plugins=(... extract)
| `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 64678fede..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|zpaq)(-.)'" \
+ "*::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 4c84ef883..7b7a2fa4f 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -72,7 +72,7 @@ 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