1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-22 04:11:58 +00:00

feat(extract): add pbzip2 and pixz (#11435)

This commit is contained in:
xiagw 2023-01-16 20:19:01 +08:00 committed by GitHub
parent df658350a3
commit 4b5076b5ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,12 +30,15 @@ EOF
local extract_dir="${1:t:r}" local extract_dir="${1:t:r}"
local file="$1" full_path="${1:A}" local file="$1" full_path="${1:A}"
case "${file:l}" in case "${file:l}" in
(*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$file" | tar xv } || tar zxvf "$file" ;; (*.tar.gz|*.tgz)
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$file" ;; (( $+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) (*.tar.xz|*.txz)
(( $+commands[pixz] )) && { tar -I pixz -xvf "$file" } || {
tar --xz --help &> /dev/null \ tar --xz --help &> /dev/null \
&& tar --xz -xvf "$file" \ && tar --xz -xvf "$file" \
|| xzcat "$file" | tar xvf - ;; || xzcat "$file" | tar xvf - } ;;
(*.tar.zma|*.tlz) (*.tar.zma|*.tlz)
tar --lzma --help &> /dev/null \ tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$file" \ && tar --lzma -xvf "$file" \