1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 23:08:00 +00:00

Handle tar.xz and tar.lzma better (credit: @gwjo).

This commit is contained in:
Sorin Ionescu 2011-04-17 23:17:48 -04:00
parent 9ded21d21b
commit 922fec1d4b

View File

@ -2,7 +2,7 @@
# FILE: extract.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.0.0
# VERSION: 1.0.1
# ------------------------------------------------------------------------------
@ -40,10 +40,12 @@ function extract() {
case "$1" in
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) tar xvJf "$1" ;;
# (*.tar.xz|*.txz) xzcat "$1" | tar xvf - ;;
(*.tar.lzma|*.tlz) tar --lzma -xvf "$1" ;;
# (*.tar.lzma|*.tlz) lzcat "$1" | tar xvf - ;;
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
|| xzcat "$1" | tar xvf - ;;
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
(*.gz) gunzip "$1" ;;
(*.bz2) bunzip2 "$1" ;;