diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2010-02-08 10:24:38 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2010-02-08 10:24:38 +0000 |
commit | 5d71d12ed2c19dd295a077127e5736c7718cbab3 (patch) | |
tree | 2369593602c464fc0a1346bc4c6afad647175b45 /Completion/Unix | |
parent | d7dab4fee66d80c57fb2b673908a4ae87761c8b5 (diff) | |
download | zsh-5d71d12ed2c19dd295a077127e5736c7718cbab3.tar.gz zsh-5d71d12ed2c19dd295a077127e5736c7718cbab3.tar.xz zsh-5d71d12ed2c19dd295a077127e5736c7718cbab3.zip |
27658: work around globbing problems in zip completion
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Command/_zip | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index 26e19a119..a6baa9757 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -1,6 +1,6 @@ #compdef zip unzip zipinfo -local suffixes suf zipfile uzi +local suffixes suf zipfile uzi testfile local expl curcontext="$curcontext" state line ret=1 typeset -A opt_args @@ -114,10 +114,18 @@ case $state in if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then _wanted files expl zfile _files -g '^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return else - zipfile=( $~line[1](|.zip|.ZIP) ) - [[ -z $zipfile[1] ]] && return 1 - if [[ $zipfile[1] != $_zip_cache_list ]]; then - _zip_cache_name="$zipfile[1]" + testfile=${~${(Q)line[1]}} + if [[ -f $testfile ]]; then + zipfile=$testfile + 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)"} ) fi _wanted files expl 'file from archive' \ |