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

Add rar command to archive module

This addition tries to use the rar command if unrar is not found.

Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
This commit is contained in:
nasenatmer 2013-05-14 22:06:24 +01:00 committed by Sorin Ionescu
parent fb5b1be345
commit 88408e8bc2
3 changed files with 7 additions and 3 deletions

View File

@ -26,7 +26,7 @@ installed:
- *.lzma* requires `unlzma`. - *.lzma* requires `unlzma`.
- *.Z* requires `uncompress`. - *.Z* requires `uncompress`.
- *.zip* requires `unzip`. - *.zip* requires `unzip`.
- *.rar* requires `unrar`. - *.rar* requires `unrar` or `rar`.
- *.7z* requires `7za`. - *.7z* requires `7za`.
- *.deb* requires `ar`, `tar`. - *.deb* requires `ar`, `tar`.

View File

@ -53,7 +53,9 @@ while (( $# > 0 )); do
(*.lzma) unlzma "$1" ;; (*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;; (*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;; (*.zip) unzip "$1" -d $extract_dir ;;
(*.rar) unrar e -ad "$1" ;; (*.rar) unrar &> /dev/null \
&& unrar e -ad "$1" \
|| rar e -ad "$1" ;;
(*.7z) 7za x "$1" ;; (*.7z) 7za x "$1" ;;
(*.deb) (*.deb)
mkdir -p "$extract_dir/control" mkdir -p "$extract_dir/control"

View File

@ -41,7 +41,9 @@ while (( $# > 0 )); do
|| lzcat "$1" | tar x${verbose:+v}f - ;; || lzcat "$1" | tar x${verbose:+v}f - ;;
(*.tar) tar t${verbose:+v}f "$1" ;; (*.tar) tar t${verbose:+v}f "$1" ;;
(*.zip) unzip -l${verbose:+v} "$1" ;; (*.zip) unzip -l${verbose:+v} "$1" ;;
(*.rar) unrar ${${verbose:+v}:-l} "$1" ;; (*.rar) unrar &> /dev/null \
&& unrar ${${verbose:+v}:-l} "$1" \
|| rar ${${verbose:+v}:-l} "$1" ;;
(*.7z) 7za l "$1" ;; (*.7z) 7za l "$1" ;;
(*) (*)
print "$0: cannot list: $1" >&2 print "$0: cannot list: $1" >&2