Browse Source

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

Sorin Ionescu 14 years ago
parent
commit
922fec1d4b
  1. 12
      plugins/extract/extract.plugin.zsh

12
plugins/extract/extract.plugin.zsh

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

Loading…
Cancel
Save