archive: add support for *.jar files (#1302)

main
Khai Do 8 years ago committed by Kaleb Elwert
parent c38c2dd909
commit 7242b4ed49

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

@ -10,4 +10,4 @@
_arguments \ _arguments \
'(-v --verbose)'{-v,--remove}'[verbose archive listing]' \ '(-v --verbose)'{-v,--remove}'[verbose archive listing]' \
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0 "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z)(-.)'" && return 0

@ -10,4 +10,4 @@
_arguments \ _arguments \
'(-r --remove)'{-r,--remove}'[remove archive]' \ '(-r --remove)'{-r,--remove}'[remove archive]' \
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z|deb)(-.)'" && return 0

@ -40,7 +40,7 @@ while (( $# > 0 )); do
&& tar --lzma -t${verbose:+v}f "$1" \ && tar --lzma -t${verbose:+v}f "$1" \
|| 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|*.jar) unzip -l${verbose:+v} "$1" ;;
(*.rar) unrar &> /dev/null \ (*.rar) unrar &> /dev/null \
&& unrar ${${verbose:+v}:-l} "$1" \ && unrar ${${verbose:+v}:-l} "$1" \
|| rar ${${verbose:+v}:-l} "$1" ;; || rar ${${verbose:+v}:-l} "$1" ;;

@ -54,7 +54,7 @@ while (( $# > 0 )); do
(*.xz) unxz "$1" ;; (*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;; (*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;; (*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;; (*.zip|*.jar) unzip "$1" -d $extract_dir ;;
(*.rar) unrar &> /dev/null \ (*.rar) unrar &> /dev/null \
&& unrar x -ad "$1" \ && unrar x -ad "$1" \
|| rar x -ad "$1" ;; || rar x -ad "$1" ;;

Loading…
Cancel
Save