diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 371f4a1f..02b05eb4 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -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" ;;