From 4b5076b5ec450d30270f31a68d0299392ada042d Mon Sep 17 00:00:00 2001 From: xiagw Date: Mon, 16 Jan 2023 20:19:01 +0800 Subject: [PATCH] feat(extract): add `pbzip2` and `pixz` (#11435) --- plugins/extract/extract.plugin.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 1112dd52f..563d88c72 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -30,12 +30,15 @@ EOF local extract_dir="${1:t:r}" local file="$1" full_path="${1:A}" case "${file:l}" in - (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$file" | tar xv } || tar zxvf "$file" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$file" ;; + (*.tar.gz|*.tgz) + (( $+commands[pigz] )) && { tar -I pigz -xvf "$file" } || tar zxvf "$file" ;; + (*.tar.bz2|*.tbz|*.tbz2) + (( $+commands[pbzip2] )) && { tar -I pbzip2 -xvf "$file" } || tar xvjf "$file" ;; (*.tar.xz|*.txz) + (( $+commands[pixz] )) && { tar -I pixz -xvf "$file" } || { tar --xz --help &> /dev/null \ && tar --xz -xvf "$file" \ - || xzcat "$file" | tar xvf - ;; + || xzcat "$file" | tar xvf - } ;; (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ && tar --lzma -xvf "$file" \