mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-18 13:01:05 +02:00
27658: work around globbing problems in zip completion
This commit is contained in:
parent
d7dab4fee6
commit
5d71d12ed2
1 changed files with 13 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
#compdef zip unzip zipinfo
|
#compdef zip unzip zipinfo
|
||||||
|
|
||||||
local suffixes suf zipfile uzi
|
local suffixes suf zipfile uzi testfile
|
||||||
local expl curcontext="$curcontext" state line ret=1
|
local expl curcontext="$curcontext" state line ret=1
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
|
||||||
|
@ -114,10 +114,18 @@ case $state in
|
||||||
if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
|
if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
|
||||||
_wanted files expl zfile _files -g '^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return
|
_wanted files expl zfile _files -g '^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return
|
||||||
else
|
else
|
||||||
zipfile=( $~line[1](|.zip|.ZIP) )
|
testfile=${~${(Q)line[1]}}
|
||||||
[[ -z $zipfile[1] ]] && return 1
|
if [[ -f $testfile ]]; then
|
||||||
if [[ $zipfile[1] != $_zip_cache_list ]]; then
|
zipfile=$testfile
|
||||||
_zip_cache_name="$zipfile[1]"
|
elif [[ -f $testfile.zip ]]; then
|
||||||
|
zipfile=$testfile.zip
|
||||||
|
elif [[ -f $testfile.ZIP ]]; then
|
||||||
|
zipfile=$testfile.ZIP
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [[ $zipfile != $_zip_cache_name ]]; then
|
||||||
|
_zip_cache_name="$zipfile"
|
||||||
_zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} )
|
_zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} )
|
||||||
fi
|
fi
|
||||||
_wanted files expl 'file from archive' \
|
_wanted files expl 'file from archive' \
|
||||||
|
|
Loading…
Reference in a new issue