From 922fec1d4b76a140260a60140112b16aeec8ddd4 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Apr 2011 23:17:48 -0400 Subject: [PATCH] Handle tar.xz and tar.lzma better (credit: @gwjo). --- plugins/extract/extract.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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" ;;