1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

18631: returning too early breaks prefix-needed style set to false

This commit is contained in:
Oliver Kiddle 2003-06-25 09:03:04 +00:00
parent dd54fb2498
commit a267832ddf
26 changed files with 179 additions and 139 deletions

@ -1,3 +1,20 @@
2003-06-25 Oliver Kiddle <opk@zsh.org>
* 18631: Completion/AIX/Command/_smit,
Completion/Linux/Command/_modutils, Completion/Linux/Command/_uml,
Completion/Unix/Command/_ant, Completion/Unix/Command/_arp,
Completion/Unix/Command/_bzip2, Completion/Unix/Command/_compress,
Completion/Unix/Command/_elinks, Completion/Unix/Command/_finger,
Completion/Unix/Command/_gpg, Completion/Unix/Command/_gzip,
Completion/Unix/Command/_java, Completion/Unix/Command/_links,
Completion/Unix/Command/_look, Completion/Unix/Command/_lynx,
Completion/Unix/Command/_lzop, Completion/Unix/Command/_mt,
Completion/Unix/Command/_prcs, Completion/Unix/Command/_sccs,
Completion/Unix/Command/_telnet, Completion/Unix/Command/_w3m,
Completion/Unix/Command/_zip, Completion/Zsh/Command/_compdef,
Completion/Zsh/Command/_hash, Completion/Zsh/Command/_which:
returning too early breaks prefix-needed style set to false
2003-06-25 Clint Adams <clint@zsh.org>
* 18628: Completion/Debian/Command/_bug: update completion of

@ -18,10 +18,8 @@ _arguments -C \
'-v[verbose]' \
'-x[do not run any execute commands]' \
'-X[do not run any commands]' \
'1:fastpath:->fastpath' && return 0
'1:fast path:->fastpath'
[[ "$state" = fastpath ]] &&
[[ "$state" = fastpath ]] && (( $+commands[odmget] )) &&
_wanted fastpaths expl 'fast path' compadd \
$(odmget sm_cmd_hdr sm_name_hdr|sed -n 's/^ id = \"\(.*\)\"/\1/p')

@ -1,6 +1,6 @@
#compdef lsmod modinfo modprobe rmmod
local curcontext="$curcontext" expl state line modules ign args
local curcontext="$curcontext" expl state line modules ign args ret=1
args=(
'(-)'{-V,--version}'[print version]'
@ -18,7 +18,7 @@ case "$service" in
'(-)'{-l,--license}"[display the module's license]" \
'(-)'{-n,--filename}"[display the module's filename]" \
'(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \
'1:module file:->all_modules' && return
'1:module file:->all_modules' && ret=0
;;
modprobe)
@ -37,7 +37,7 @@ case "$service" in
"(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
"(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
"(-c $ign)1:modules:->all_modules" \
"(-c -l --list -t --type $ign)*:params:->params" && return
"(-c -l --list -t --type $ign)*:params:->params" && ret=0
[[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules
;;
@ -49,7 +49,7 @@ case "$service" in
'(-r --stacks)'{-r,--stacks}'[remove a module stack]' \
'(-s --syslog)'{-s,--syslog}'[output to syslog]' \
'(-v --verbose)'{-v,--verbose}'[be verbose]' \
'*:loaded module:->loaded_modules' && return
'*:loaded module:->loaded_modules' && ret=0
;;
esac
@ -80,4 +80,4 @@ case "$state" in
;;
esac
return 1
return ret

@ -12,6 +12,7 @@ case $service in
_arguments \
'-unix[listen on specified pair of sockets]:control socket: :data socket' \
'-hub[act like a hub]'
return
;;
uml_mconsole)
if (( CURRENT == 2 )); then
@ -46,7 +47,7 @@ case $service in
'(* -)--version[display kernel version number]' \
'(* -)--help[print usage information]' \
'(* -)--showconfig[show kernel configuration]' \
'(-)*:option:->option' && return
'(-)*:option:->option' && ret=0
;;
tunctl)
_arguments \
@ -55,6 +56,7 @@ case $service in
'(-d)-u[specify owner]:owner:_users' \
'(-b -u -t)-d[specify devicename to delete]:device name:(tap{0..9})' \
'(-d)-t[specify devicename]:device name:(tap{0..9})'
return
;;
esac

@ -1,7 +1,7 @@
#compdef ant -value-,ANT_ARGS,-default-
typeset -A opt_args
local buildfile tmp state line curcontext="$curcontext"
local buildfile tmp state line curcontext="$curcontext" ret=1
local c target='*:target:->target'
c=( $ANT_HOME/lib/*.jar )
@ -30,7 +30,7 @@ _arguments -C \
'-propertyfile[load properties from specified file]:property file:_files' \
'-inputhandler[specify class which will handle input requests]:class:_java_class -cp ${(j.\:.)c}' \
'(-f -file -buildfile)-find[search for build file towards the root of filesystem]:build file:(build.xml)' \
$target && return
$target && ret=0
case $state in
property)
@ -78,7 +78,7 @@ case $state in
esac
done
)//$'\015'}"
_describe 'target' tmp
_describe 'target' tmp && ret=0
else
if [[ -n $opt_args[-find] ]]; then
buildfile=( (../)#${opt_args[-find]:-build.xml}(N[-1]) )
@ -87,10 +87,12 @@ case $state in
fi
if [[ -f $buildfile ]]; then
targets=( $(sed -n 's/ *<target name="\([^"]*\)".*/\1/p' < $buildfile) )
_wanted targets expl target compadd -a targets
_wanted targets expl target compadd -a targets && ret=0
else
_message -e targets target
fi
fi
;;
esac
return ret

@ -7,7 +7,7 @@ _arguments -C \
'(-a -s -f 1)-d[delete entry from table]:host:->hostintable' \
'(-a -d -f 1)-s[create an arp entry]:host:_hosts:ethernet address::*:option:(temp trail pub)' \
'(-a -d -s 1)-f[read multiple entries from file]:file:_files' \
'(-a)1:host:->hostintable' && return 0
'(-a)1:host:->hostintable'
[[ "$state" = hostintable ]] &&
_wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*}

@ -1,6 +1,6 @@
#compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -redirect-,<,bunzip2=bunzip2 -redirect-,>,bzip2=bunzip2 -redirect-,<,bzip2=bzip2
local decompress expl state line curcontext="$curcontext"
local decompress expl state line curcontext="$curcontext" ret=1
typeset -A opt_args
case "$service" in
@ -39,7 +39,7 @@ case "$service" in
'(-1 -2 -3 -4 -5 -6 -8 -9)-7' \
'(-1 -2 -3 -4 -5 -6 -7 -9)-8' \
'(-1 -2 -3 -4 -5 -6 -7 -8 )-9' \
'*:files:->files' && return 0
'*:files:->files' && ret=0
;;
esac
@ -49,11 +49,11 @@ if [[ "$state" = files ]]; then
$+opt_args[--test] )) && unset decompress
if [[ -z "$decompress" ]]; then
_description files expl 'compressed file'
_files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return 0
_files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return
else
_description files expl 'file to compress'
_files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return 0
_files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return
fi
fi
return 1
return ret

@ -1,6 +1,6 @@
#compdef compress uncompress -redirect-,<,uncompress=uncompress -redirect-,>,compress=uncompress -redirect-,<,compress=compress
local expl state line bits common_args1 common_args2 decompress
local expl state line bits common_args1 common_args2 decompress ret=1
local curcontext="$curcontext"
typeset -A opt_args
bits=( {9..16} )
@ -23,14 +23,14 @@ case "$service" in
"-b[specify maximum number of bits used to replace common substring]:bits:(${bits[*]})" \
'-C[produce output compatible with BSD 2.0]' \
'(-b -C)-d[decompress]' \
"${common_args2[@]}" && return 0
"${common_args2[@]}" && ret=0
;;
uncompress)
_arguments -C -s "${common_args2[@]}" && return 0
_arguments -C -s "${common_args2[@]}" && ret=0
decompress=yes
;;
zcat)
_arguments -C -s "${common_args1[@]}" && return 0
_arguments -C -s "${common_args1[@]}" && ret=0
decompress=yes
;;
esac
@ -38,11 +38,11 @@ esac
if [[ "$state" = files ]]; then
if [[ -z "$decompress" ]] || (( $+opt_args[-d] )); then
_description files expl 'file to compress'
_files "$expl[@]" -g '*~*.Z' && return 0
_files "$expl[@]" -g '*~*.Z' && return
else
_description files expl 'compressed file'
_files "$expl[@]" -g '*.Z' && return 0
_files "$expl[@]" -g '*.Z' && return
fi
fi
return 1
return ret

@ -25,7 +25,7 @@ _arguments -C -A '-*' \
'(1)*-stdin[read document from stdin]::boolean:(0 1)' \
'*-touch-files[touch files in ~/.elinks when running with -no-connect/-session-ring]::boolean:(0 1)' \
'(- 1)-version[print version information and exit]' \
'1:url:->url' && return
'1:url:->url' && ret=0
if [[ "$state" = url ]]; then
local elinks_bookmarks
@ -40,4 +40,4 @@ if [[ "$state" = url ]]; then
'urls:url:_urls' && return
fi
return 1
return ret

@ -1,10 +1,10 @@
#compdef finger
local curcontext="$curcontext" state line match
local curcontext="$curcontext" state line match ret=1
typeset -A opt_args
if (( ! $+_finger_args )); then
local help="$(_call_program options finger -\? 2>&1)"
local help="$(_call_program options finger -\\\? 2>&1)"
local -A optionmap
## `finger -\?':
@ -69,10 +69,12 @@ if (( ! $+_finger_args )); then
fi
fi
_arguments -C -s $_finger_args '*:finger targets:->finger-targets' && return 0
_arguments -C -s $_finger_args '*:finger targets:->finger-targets' && ret=0
case "$state" in
finger-targets)
_user_at_host -t other-accounts "$@"
_user_at_host -t other-accounts "$@" && return
;;
esac
return ret

@ -1,6 +1,6 @@
#compdef gpg gpgv
local curcontext="$curcontext" state line expl
local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
_arguments -C -s -S -A "-*" \
@ -127,7 +127,7 @@ _arguments -C -s -S -A "-*" \
--enable-special-filenames --no-expensive-trust-checks --group:name=value \
--preserve-permissions --personal-{cipher,digest,compress}-preferences:string \
--default-preference-list:string \
'*:args:->args' && return
'*:args:->args' && ret=0
if [[ $state = args ]]; then
if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} )); then
@ -154,4 +154,4 @@ case "$state" in
;;
esac
return 1
return ret

@ -1,6 +1,6 @@
#compdef gzip gunzip gzcat=gunzip -redirect-,<,gunzip=gunzip -redirect-,>,gzip=gunzip -redirect-,<,gzip=gzip -value-,GZIP,-default-
local decompress files expl curcontext="$curcontext" state line
local decompress files expl curcontext="$curcontext" state line ret=1
typeset -A opt_args
files=( '*:files:->files' )
@ -58,7 +58,7 @@ gzip)
'(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \
'(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \
'(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \
"$files[@]" && return 0
"$files[@]" && ret=0
;;
esac
@ -71,19 +71,21 @@ files)
if (( $+opt_args[-r] || $+opt_args[--recursive] )); then
if [[ -z "$decompress" ]]; then
_description directories expl 'directory to compress'
_files "$expl[@]" -/
_files "$expl[@]" -/ && return
else
_description directories expl 'compressed directory'
_files "$expl[@]" -/
_files "$expl[@]" -/ && return
fi
else
if [[ -z "$decompress" ]]; then
_description files expl 'file to compress'
_files "$expl[@]" -g '*~*.(([tT]|)[gG]|)[zZ]'
_files "$expl[@]" -g '*~*.(([tT]|)[gG]|)[zZ]' && return
else
_description files expl 'compressed file'
_files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ]'
_files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ]' && return
fi
fi
;;
esac
return ret

@ -1,6 +1,6 @@
#compdef javac java javadoc appletviewer jar jdb javah javap extcheck rmic rmiregistry rmid serialvar native2ascii keytool jarsigner policytool
local expl tmp jdb_args jar_cmd match basedir
local expl tmp jdb_args jar_cmd match basedir ret=1
local curcontext="$curcontext" state line jf
typeset -A opt_args tmpassoc
@ -89,7 +89,7 @@ javadoc)
'-helpfile[specify alternative help link]:helpfile path/filename:' \
'-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \
'-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \
'*:package name, source file or @list:->docsrc' && return 0
'*:package name, source file or @list:->docsrc' && ret=0
;;
appletviewer)
@ -112,7 +112,7 @@ jar)
'v[verbose mode]' \
'm[specify manifest file]' \
'0[store only without using ZIP compression]' \
'M[do not create manifest file]'
'M[do not create manifest file]' && return
else
jar_cmd="${words[2]#-}"
tmpassoc=(
@ -186,7 +186,7 @@ rmic)
rmiregistry)
if (( CURRENT == 2 )); then
_wanted ports expl 'port to listen' _ports
_wanted ports expl 'port to listen' _ports && return
else
_message 'no more arguments'
fi
@ -359,11 +359,11 @@ case "$state" in
debug)
if [[ -prefix :*, ]]; then
compset -P :
_values -s , "debug info" lines vars source
_values -s , "debug info" lines vars source && return
else
_description debuginfo expl "debug info"
compadd -P: "$expl[@]" none
compadd -P: -qS, "$expl[@]" lines vars source
compadd -P: "$expl[@]" none && ret=0
compadd -P: -qS, "$expl[@]" lines vars source && ret=0
fi
;;
@ -372,12 +372,12 @@ classpath|sourcepath|bootstrapclasspath|docletpath)
compset -S ':*'
_alternative \
"classpath:$state:_path_files -qS: -g '*.(jar|zip)'" \
"classpath:$state:_path_files -r': ' -/"
"classpath:$state:_path_files -r': ' -/" && return
;;
extdirs)
compset -P '*:'
_path_files -/
_path_files -/ && return
;;
encoding)
@ -540,7 +540,7 @@ encoding)
property)
if compset -P '*='; then
_default
_default && return
else
_message -e property-names 'property name'
fi
@ -548,30 +548,30 @@ property)
docsrc)
if compset -P @; then
_wanted files expl 'package/source list file' _files
_wanted files expl 'package/source list file' _files && return
else
_wanted files expl 'package or source' _files -g '*.java'
_wanted files expl 'package or source' _files -g '*.java' && return
fi
;;
jararg)
if [[ -prefix - ]]; then
tmp=('-C:chdir')
_describe -o 'option' tmp --
_describe -o 'option' tmp -- && return
elif [[ "$words[CURRENT - 2]" == -C ]]; then
_wanted file expl 'input file' _files -W "($words[CURRENT - 1])"
_wanted file expl 'input file' _files -W "($words[CURRENT - 1])" && return
elif [[ "$words[CURRENT - 1]" == -C ]]; then
_wanted directories expl 'chdir to' _files -/
_wanted directories expl 'chdir to' _files -/ && return
elif [[ $words[2] = *x* ]]; then
jf="$words[3]"
if [[ $jf != $_jar_cache_name && -f $jf ]]; then
_jar_cache_list=("${(@f)$($words[1] tf $jf)}")
_jar_cache_name=$jf
fi
jf="$words[3]"
if [[ $jf != $_jar_cache_name && -f $jf ]]; then
_jar_cache_list=("${(@f)$($words[1] tf $jf)}")
_jar_cache_name=$jf
fi
_wanted files expl 'file from archive' _multi_parts / _jar_cache_list
_wanted files expl 'file from archive' _multi_parts / _jar_cache_list && return
else
_wanted files expl 'input file' _files
_wanted files expl 'input file' _files && return
fi
;;
@ -579,3 +579,5 @@ jararg)
_message "unknown state: $state"
;;
esac
return ret

@ -1,6 +1,6 @@
#compdef links
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
@ -25,8 +25,10 @@ _arguments -C \
'(-help)-source[dump the source page]' \
'(-help)-unrestartable-receive-timeout[timeout on non restartable connections]:secs:' \
'(-help)-version[prints the links version number and exit]' \
':url:->html' && return 0
':url:->html' && ret=0
if [[ "$state" = html ]]; then
_alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls'
_alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls' && ret=0
fi
return ret

@ -1,6 +1,6 @@
#compdef look
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C -s \
@ -8,14 +8,9 @@ _arguments -C -s \
'-f[case insensitive]' \
'-d[dictionary order]' \
':string:->string' \
':dictionary file:_files' && return 0
':dictionary file:_files' && ret=0
case "$state" in
string)
if [[ -n "$PREFIX" ]]; then
_wanted values expl 'word prefix' compadd - $(_call_program values $words[1] $PREFIX)
else
_message -e prefixes 'word prefix'
fi
;;
esac
[[ -n "$state" && ! -prefix - ]] && _wanted values expl 'word prefix' \
compadd - $(_call_program words $words[1] '"$PREFIX"') && return
return ret

@ -1,6 +1,6 @@
#compdef lynx
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
@ -128,7 +128,7 @@ _arguments -C \
'-vikeys' \
'-width=:NUMBER:' \
'-with_backspaces' \
':url:->html' && return 0
':url:->html' && ret=0
case "$state" in
restrictions)
@ -137,9 +137,11 @@ restrictions)
disk_save dotfiles download editor exec exec_frozen externals file_url \
goto inside_ftp inside_news inside_rlogin inside_telnet jump mail \
multibook news_post options_save outside_ftp outside_news outside_rlogin \
outside_telnet print shell suspend telnet_port useragent
outside_telnet print shell suspend telnet_port useragent && return
;;
html)
_alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls'
_alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls' && return
;;
esac
return ret

@ -1,6 +1,6 @@
#compdef lzop
local expl state line decompress disp curcontext="$curcontext" sep
local expl state line decompress disp curcontext="$curcontext" sep ret=1
typeset -A opt_args
_arguments -C -s \
@ -74,7 +74,7 @@ _arguments -C -s \
'--color[assume a color ANSI terminal]' \
'--intro[display intro sequence]' \
'--filter=[preprocess data with a special multimedia filter]:number' \
'*:files:->files' && return 0
'*:files:->files' && ret=0
case "$state" in
files)
@ -83,10 +83,10 @@ case "$state" in
$+opt_args[--test] || $+opt_args[-t] || $+opt_args[--list] ||
$+opt_args[-l] || $+opt_args[--ls] || $+opt_args[--info] )); then
_description files expl 'compressed file'
_files "$expl[@]" -g '*.[tl]zo'
_files "$expl[@]" -g '*.[tl]zo' && ret=0
else
_description files expl 'file to compress'
_files "$expl[@]" -g '*~*.[tl]zo'
_files "$expl[@]" -g '*~*.[tl]zo' && ret=0
fi
;;
@ -98,6 +98,8 @@ case "$state" in
"Q $sep Enclose file names in double quotes" )
disp=( ${disp[@]:#[Z$PREFIX]*} )
compset -P '[FGQ]*'
compadd -d disp - ${disp[@]%% *}
compadd -d disp - ${disp[@]%% *} && ret=0
;;
esac
return ret

@ -1,7 +1,7 @@
#compdef mt
local -a args cmds
local state line curcontext="$curcontext"
local state line curcontext="$curcontext" ret=1
args=( '(-)-f[specify raw tape device]:tape device:_files' )
cmds=(
@ -73,6 +73,8 @@ elif [[ $OSTYPE = solaris* ]]; then
fi
_arguments -C "$args[@]" '(--help --version -V)1:operation:->operation' \
'2:count:' && return
'2:count:' && ret=0
[[ -n "$state" ]] && _describe -t operations 'operation' cmds
[[ -n "$state" ]] && _describe -t operations 'operation' cmds && ret=0
return ret

@ -1,6 +1,6 @@
#compdef prcs
local curcontext="$curcontext" state line subcmds
local curcontext="$curcontext" state line subcmds ret=1
typeset -A opt_args
# lookup project names in the repository
@ -34,7 +34,7 @@ _prcs_arguments() {
_arguments -C \
'(* -)'{-h,-H,--help}'[print out help]' \
'(* -)--version[display program version]' \
'*:: :->subcmd' && return 0
'*:: :->subcmd' && ret=0
if (( CURRENT == 1 )); then
subcmds=(
@ -54,8 +54,8 @@ if (( CURRENT == 1 )); then
'unpackage:unpackage project in packagefile'
)
_describe -t commands 'prcs command' subcmds
return
_describe -t commands 'prcs command' subcmds && ret=0
return ret
fi
curcontext="${curcontext%:*}-$words[1]:"

@ -15,7 +15,7 @@ _sccs_files() {
return ret
}
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
local subcmds ropt copt sfiles finalpath
@ -56,12 +56,13 @@ if [[ $service = sccs ]]; then
'-r[run with real and not effective user ID]' \
'-d+[specify root prefix]:root prefix:_directories' \
'-p+[specify subdirectory of history file]:path to history file:_directories' \
'*::command:->subcmd' && return 0
'*::command:->subcmd' && ret=0
if (( CURRENT == 1 )); then
_describe -t commands 'sccs command' subcmds
return
_describe -t commands 'sccs command' subcmds && ret=0
fi
(( ret )) || return 0
service="$words[1]"
sfiles=':file:_sccs_files'
curcontext="${curcontext%:*}-$service:"

@ -5,7 +5,7 @@
# telnet_hosts_ports_users
# The array that contains 3-tuples `host:port:user'.
local curcontext="$curcontext" state line expl
local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
if (( ! $+_telnet_args )); then
@ -43,14 +43,14 @@ fi
_arguments -C -s \
"$_telnet_args[@]" \
':host:->hosts' \
':port:->ports' && return 0
':port:->ports' && ret=0
case "$state" in
hosts)
_wanted hosts expl host \
_combination -s '[@:]' '' users-hosts-ports \
${opt_args[-l]:+users=${opt_args[-l]:q}} \
hosts -
hosts - && ret=0
;;
ports)
@ -58,7 +58,7 @@ ports)
_combination -s '[@:]' '' users-hosts-ports \
${opt_args[-l]:+users=${opt_args[-l]:q}} \
hosts="${line[1]:q}" \
ports -
ports - && ret=0
;;
users)
@ -66,6 +66,8 @@ users)
_combination -s '[@:]' '' users-hosts-ports \
${line[2]:+hosts="${line[2]:q}"} \
${line[3]:+ports="${line[3]:q}"} \
users -
users - && ret=0
;;
esac
return ret

@ -1,6 +1,6 @@
#compdef w3m
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
@ -31,18 +31,19 @@ _arguments -C \
'-o[option]:option-value:' \
'-config:config file:_files' \
'-debug' \
':url:->url' && return 0
':url:->url' && ret=0
case $state in
url)
local _w3mhistory
url)
local _w3mhistory
if [[ -s ~/.w3m/history ]]; then
_w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
compadd $_w3mhistory
fi
_urls -f
;;
if [[ -s ~/.w3m/history ]]; then
_w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
compadd $_w3mhistory && ret=0
fi
_urls -f && ret=0
;;
esac
return ret

@ -1,7 +1,7 @@
#compdef zip unzip zipinfo
local suffixes suf zipfile uzi
local expl curcontext="$curcontext" state line
local expl curcontext="$curcontext" state line ret=1
typeset -A opt_args
case $service in
@ -51,7 +51,7 @@ case $service in
'-x[exclude the following names]' \
'-i[include only the following names]' \
"(-f -d -R -q -c -b -@ -F -FF -A -T -y -e -h -u -m -g -j -l -ll -L -v -z -t -tt -o -D -J -X -n -0 -1 -2 -3 -4 -5 -6 -7 -8 -9):zip file:_files -g '(#i)*.(zip|[ejw]ar)'" \
'*:file:->files' && return 0
'*:file:->files' && ret=0
;;
unzip)
_arguments -C -s \
@ -76,7 +76,7 @@ case $service in
'-x[exclude the following names]' \
'-Z[zipinfo mode]:zipinfomode:->zipinfo' \
"(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|[ejw]ar)'" \
'*:file:->files' && return 0
'*:file:->files' && ret=0
;;
esac
@ -99,7 +99,7 @@ if [[ $service == zipinfo ]] || [[ -n $uzi ]]; then
'-M[page output]' \
'-x[exclude the following names]' \
"(-1 -2 -s -m -l -v -h -z -C -t -T -M)1:zip file:_files -g '(#i)*.(zip|[ejw]ar)'" \
'*:file:->files' && return 0
'*:file:->files' && ret=0
fi
case $state in
@ -108,11 +108,11 @@ case $state in
compset -S ':*' || suf=":."
suffixes=( *.*(N:e) )
_wanted suffixes expl suffixes \
compadd -S "$suf" -r ": \t" .$^suffixes && return 0
compadd -S "$suf" -r ": \t" .$^suffixes && return
;;
files)
if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
_files -g '^(#i)*.(zip|[ejw]ar)' && return 0
_wanted files expl zfile _files -g '^(#i)*.(zip|[ejw]ar)' && return
else
zipfile=( $~line[1](|.zip|.ZIP) )
[[ -z $zipfile[1] ]] && return 1
@ -121,7 +121,9 @@ case $state in
_zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} )
fi
_wanted files expl 'file from archive' \
_multi_parts / _zip_cache_list && return 0
_multi_parts / _zip_cache_list && return
fi
;;
esac
return ret

@ -32,7 +32,7 @@ _arguments -C -s -S \
'*-P[completion for command matching pattern]' \
':completion function:->cfun' \
'*:commands:->com' \
"$args2[@]" && return 0
"$args2[@]" && ret=0
if [[ $state = multi ]]; then
case $(( CURRENT % 3 )) in
@ -50,20 +50,20 @@ case $state in
if (( pat && pat > normal )); then
_message -e patterns 'pattern'
else
_command_names
_command_names && ret=0
fi
;;
ccom)
_wanted commands expl 'completed command' compadd -k _comps
_wanted commands expl 'completed command' compadd -k _comps && ret=0
;;
cfun)
list=( ${^fpath:/.}/_(|*[^~])(:t) )
if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
disp=( ${list[@]#_} )
_wanted functions expl 'completion function' \
compadd -d disp -a list
compadd -d disp -a list && ret=0
else
_wanted functions expl 'completion function' compadd -a list
_wanted functions expl 'completion function' compadd -a list && ret=0
fi
;;
style)
@ -71,6 +71,8 @@ case $state in
compadd -M 'r:|-=* r:|=*' \
complete-word delete-char-or-list expand-or-complete \
expand-or-complete-prefix list-choices menu-complete \
menu-expand-or-complete reverse-menu-complete
menu-expand-or-complete reverse-menu-complete && ret=0
;;
esac
return ret

@ -1,6 +1,6 @@
#compdef hash rehash
local state line expl common_args curcontext="$curcontext"
local state line expl common_args curcontext="$curcontext" ret=1
typeset -A opt_args
common_args=( \
@ -15,7 +15,7 @@ case ${service} in
'(-f -r -m)-v[list entries as they are added]' \
'(-f -r -v)-L[list in the form of calls to hash]' \
"${common_args[@]}" \
'(-d -f -r -m -v -L)*:hash:->hashval' && return 0
'(-d -f -r -m -v -L)*:hash:->hashval' && ret=0
;;
rehash)
_arguments -C -s ${common_args[@]} && return 0
@ -25,14 +25,16 @@ esac
if [[ $state = hashval ]]; then
if (( $+opt_args[-d] )); then
if compset -P 1 '*='; then
_wanted -C value files expl directories _path_files -/
_wanted -C value files expl directories _path_files -/ && ret=0
else
_wanted -C name named-directories expl 'named directory' \
compadd -q -S '=' -k nameddirs
compadd -q -S '=' -k nameddirs && ret=0
fi
elif compset -P 1 '*='; then
_wanted -C value values expl 'executable file' _files -g '*(-*)'
_wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0
else
_wanted -C name commands expl command compadd -q -S '=' -k commands
_wanted -C name commands expl command compadd -q -S '=' -k commands && ret=0
fi
fi
return ret

@ -1,6 +1,6 @@
#compdef which whence where type
local farg aarg cargs args state line curcontext="$curcontext"
local farg aarg cargs args state line curcontext="$curcontext" ret=1
cargs=( \
'(-v -c)-w[print command type]' \
@ -16,11 +16,11 @@ case ${service} in
_arguments -C -s -A "-*" -S \
'(-c -w)-v[verbose output]' \
'(-v -w)-c[csh-like output]' \
"${cargs[@]}" "$farg" "$aarg" && return 0
"${cargs[@]}" "$farg" "$aarg" && ret=0
;;
where) _arguments -C -s -A "-*" -S "${cargs[@]}" && return 0;;
which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && return 0;;
type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && return 0;;
where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;;
which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;;
type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;;
esac
if [[ "$state" = command ]]; then
@ -32,6 +32,8 @@ if [[ "$state" = command ]]; then
'builtins:builtin command:compadd -k builtins' \
'functions:shell function:compadd -k functions' \
'aliases:alias:compadd -k aliases' \
'reserved-words:reserved word:compadd -k reswords'
'reserved-words:reserved word:compadd -k reswords' && ret=0
fi
return ret