diff --git a/plugins/extract/README.md b/plugins/extract/README.md index 9cc688f6a..623fd90a1 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -49,6 +49,8 @@ plugins=(... extract) | `tar.xz` | Tarball with lzma2 compression | | `tar.zma` | Tarball with lzma compression | | `tar.zst` | Tarball with zstd compression | +| `tar.Z` | Tarball with compress (LZW) compression | +| `taz` | Tarball with compress (LZW) compression | | `tbz` | Tarball with bzip compression | | `tbz2` | Tarball with bzip2 compression | | `tgz` | Tarball with gzip compression | diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 51a4522ed..966c00bab 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -97,6 +97,11 @@ EOF && tar --zstd -xvf "$full_path" \ || zstdcat "$full_path" | tar xvf - ;; (*.tar) tar xvf "$full_path" ;; + # `tar cf - dir | compress > dir.tar.Z`: the plain `.Z` arm below only decompresses the + # stream back to `dir.tar`, so the combined form has to untar it in one step. `.taz` is the + # historic name for the same file, next to `.tgz`/`.tbz`/`.tlz`/`.txz`/`.tzst`. Matching is + # on the lowercased name, so `.tar.Z` lands here too. + (*.tar.z|*.taz) uncompress -c "$full_path" | tar xvf - ;; (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;; (*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;; (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;