a4f08ad238dba23a68df2a89b8fd47b8a9d26b0e

Author
Filippo Bonazzi <filippo.bonazzi@suse.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(extract): support `obscpio` format (#11511)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>

Diff

This diff is truncated to protect this page.

 1diff --git a/plugins/extract/README.md b/plugins/extract/README.md
 2index f67b53618a352b95adb2a1794c5b729f99225fb2..ac4a8e19717ab49c37d57988c67bde16bd6ea7f7 100644
 3--- a/plugins/extract/README.md
 4+++ b/plugins/extract/README.md
 5@@ -1,10 +1,10 @@
 6 # extract plugin
 7 
 8-This plugin defines a function called `extract` that extracts the archive file
 9-you pass it, and it supports a wide variety of archive filetypes.
10+This plugin defines a function called `extract` that extracts the archive file you pass it, and it supports a
11+wide variety of archive filetypes.
12 
13-This way you don't have to know what specific command extracts a file, you just
14-do `extract <filename>` and the function takes care of the rest.
15+This way you don't have to know what specific command extracts a file, you just do `extract <filename>` and
16+the function takes care of the rest.
17 
18 To use it, add `extract` to the plugins array in your zshrc file:
19 
20@@ -15,7 +15,7 @@ plugins=(... extract)
21 ## Supported file extensions
22 
23 | Extension         | Description                          |
24-|:------------------|:-------------------------------------|
25+| :---------------- | :----------------------------------- |
26 | `7z`              | 7zip file                            |
27 | `Z`               | Z archive (LZW)                      |
28 | `apk`             | Android app file                     |
29@@ -32,6 +32,7 @@ plugins=(... extract)
30 | `lrz`             | LRZ archive                          |
31 | `lz4`             | LZ4 archive                          |
32 | `lzma`            | LZMA archive                         |
33+| `obscpio`         | cpio archive used on OBS             |
34 | `rar`             | WinRAR archive                       |
35 | `rpm`             | RPM package                          |
36 | `sublime-package` | Sublime Text package                 |
37@@ -57,5 +58,5 @@ plugins=(... extract)
38 | `zst`             | Zstandard file (zstd)                |
39 | `zpaq`            | Zpaq file                            |
40 
41-See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
42-more information regarding archive formats.
43+See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information
44+regarding archive formats.
45diff --git a/plugins/extract/_extract b/plugins/extract/_extract
46index 64678fedeaab15d9ae757fa553dff30e833d4353..56b17058fe5d96108b354acc5ce23c0545c1efab 100644
47--- a/plugins/extract/_extract
48+++ b/plugins/extract/_extract
49@@ -3,5 +3,5 @@
50 
51 _arguments \
52   '(-r --remove)'{-r,--remove}'[Remove archive.]' \
53diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
54index 4c84ef88395a1b2c74b282bebe037c4cfb545221..7b7a2fa4fc82e00f75aff2920ff3696cd005a357 100644
55--- a/plugins/extract/extract.plugin.zsh
56+++ b/plugins/extract/extract.plugin.zsh
57@@ -72,7 +72,7 @@ EOF
58         builtin cd -q ..; command rm *.tar.* debian-binary ;;
59       (*.zst) unzstd "$file" ;;
60       (*.cab) cabextract -d "$extract_dir" "$file" ;;
61-      (*.cpio) cpio -idmvF "$file" ;;
62+      (*.cpio|*.obscpio) cpio -idmvF "$file" ;;
63       (*.zpaq) zpaq x "$file" ;;
64       (*)
65         echo "extract: '$file' cannot be extracted" >&2