diff options
Diffstat (limited to 'Completion/User')
40 files changed, 262 insertions, 246 deletions
diff --git a/Completion/User/_archie b/Completion/User/_archie index 57a5db494..cddd7680d 100644 --- a/Completion/User/_archie +++ b/Completion/User/_archie @@ -26,6 +26,6 @@ case "$state" in serverhost) : ${(A)archie_servers:=${(M)$(_call hosts archie -L):#archie.*}} - _wanted hosts expl 'archie servers' && compadd "$expl[@]" - $archie_servers + _wanted hosts expl 'archie servers' compadd - $archie_servers ;; esac diff --git a/Completion/User/_cvs b/Completion/User/_cvs index 7d55a7635..41a1b8a97 100644 --- a/Completion/User/_cvs +++ b/Completion/User/_cvs @@ -34,7 +34,7 @@ _cvs_command () { watchers "") if (( CURRENT == 1 )); then - _tags commands && { compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds} } + _wanted commands && { compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds} } else local curcontext="$curcontext" @@ -371,7 +371,7 @@ _cvs_watch () { local expl if (( CURRENT == 2 )); then - _wanted values expl 'watch comamnd' && compadd on off add remove + _wanted values expl 'watch command' compadd on off add remove else case "$words[2]" in on|off) # "+lR" @@ -427,14 +427,14 @@ _cvs_root () { fi fi - _tags files && { + _wanted files && { compadd -M 'r:|[:@./]=* r:|=*' "$@" $_cvs_roots || _files "$@" -/ } } (( $+functions[_cvs_tempdir] )) || _cvs_tempdir () { - _tags directories && compadd "$@" $TMPPREFIX:h $TMPDIR /tmp + _wanted directories && compadd "$@" $TMPPREFIX:h $TMPDIR /tmp } (( $+functions[_cvs_user_variable] )) || @@ -450,29 +450,29 @@ _cvs_user_variable () { (( $+functions[_cvs_bindir] )) || _cvs_bindir () { - _tags directories && { compadd "$@" /usr/local/bin || _files "$@" -/ } + _wanted directories && { compadd "$@" /usr/local/bin || _files "$@" -/ } } (( $+functions[_cvs_editor] )) || _cvs_editor () { - _tags commands && compadd "$@" vi + _wanted commands && compadd "$@" vi } (( $+functions[_cvs_gzip_level] )) || _cvs_gzip_level () { - _tags values && compadd "$@" 9 + _wanted values && compadd "$@" 9 } # define completion functions for cvs common options and arguments. (( $+functions[_cvs_D] )) || _cvs_D () { - _tags values && compadd "$@" today yesterday week\ ago month\ ago + _wanted values && compadd "$@" today yesterday week\ ago month\ ago } (( $+functions[_cvs_k] )) || _cvs_k () { - _tags values && compadd "$@" kv kvl k o b v + _wanted values && compadd "$@" kv kvl k o b v } (( $+functions[_cvs_m] )) || @@ -489,9 +489,8 @@ _cvs_modules () { if [[ $root = :* || ! -d $root ]]; then _message "module name" else - _wanted modules expl module && - compadd "$expl[@]" - \ - $root/^CVSROOT(:t) \ + _wanted modules expl module \ + compadd - $root/^CVSROOT(:t) \ ${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ ]*} fi } @@ -500,7 +499,7 @@ _cvs_modules () { _cvs_revisions () { local expl - _wanted values expl revision && + _wanted values expl revision \ compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:# *}##[ ]##(No Tags Exist)#}%%[ ]*} } @@ -618,7 +617,7 @@ _cvs_files_removed () { local omit omit=(${pref}*(D:t)) eval 'entries=(${entries:#('${(j:|:)${(@)omit:q}}')})' - _tags directories && compadd "$@" -P "$qpref" - ${entries:q} || + _wanted directories && compadd "$@" -P "$qpref" - ${entries:q} || _cvs_directories "$@" else _files "$@" diff --git a/Completion/User/_dd b/Completion/User/_dd index fa322d791..419fc1a7a 100644 --- a/Completion/User/_dd +++ b/Completion/User/_dd @@ -6,9 +6,8 @@ if compset -P 1 'conv='; then # If there's a comma present, ignore up to the last one. The # test alone will have that effect. compset -p '*,' - _wanted values expl conversion && - compadd "$expl[@]" -qS, -q \ - ascii ebcdic ibm block unblock lcase ucase swab noerror sync + _wanted values expl conversion \ + compadd -qS, ascii ebcdic ibm block unblock lcase ucase swab noerror sync elif compset -P 1 'if='; then _description files expl 'input file' _tilde_files "$expl[@]" @@ -16,6 +15,6 @@ elif compset -P 1 'of='; then _description files expl 'output file' _tilde_files "$expl[@]" else - _wanted values expl option && - compadd "$expl[@]" -S '=' if of ibs obs bs cbs skip files seek count conv + _wanted values expl option \ + compadd -S '=' if of ibs obs bs cbs skip files seek count conv fi diff --git a/Completion/User/_domains b/Completion/User/_domains index cf7e9befe..3cc64db07 100644 --- a/Completion/User/_domains +++ b/Completion/User/_domains @@ -16,5 +16,5 @@ if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then domains=( "$_cache_domains[@]" ) fi -_wanted domains expl domain && - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$domains[@]" +_wanted domains expl domain \ + compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" - "$domains[@]" diff --git a/Completion/User/_gcc b/Completion/User/_gcc index 7292a933c..f826f9793 100644 --- a/Completion/User/_gcc +++ b/Completion/User/_gcc @@ -273,8 +273,8 @@ dump) 'p[annotate assembler output]' && ret=0 ;; library) - _wanted libraries expl library && - compadd "$expl[@]" - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0 + _wanted libraries expl library \ + compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0 ;; esac diff --git a/Completion/User/_gdb b/Completion/User/_gdb index 283aff631..2fd09cbc5 100644 --- a/Completion/User/_gdb +++ b/Completion/User/_gdb @@ -10,18 +10,21 @@ local cur="$words[CURRENT]" prev w list ret=1 expl if compset -P '-(cd|directory)='; then _files -/ elif compset -P '-tty='; then - _wanted devices expl 'terminal device' && compadd "$expl[@]" - /dev/tty* + _wanted devices expl 'terminal device' compadd - /dev/tty* elif compset -P '-(exec|se)='; then _description files expl executable _files "$expl[@]" -g '*(-*)' elif compset -P '-(symbols|core|command)='; then _files elif [[ "$PREFIX" = -* ]]; then - if _wanted options expl option; then - compadd "$expl[@]" -QS '' - -symbols\= -exec\= -se\= -core\= -command\= \ - -directory\= -cd\= -tty\= - compadd "$expl[@]" - -help -h -s -e -c -x -d -nx -n -quiet -q \ - -batch -fullname -f -b + if _wanted options; then + while _try options expl option; do + compadd "$expl[@]" -QS '' - -symbols\= -exec\= -se\= -core\= -command\= \ + -directory\= -cd\= -tty\= && ret=0 + compadd "$expl[@]" - -help -h -s -e -c -x -d -nx -n -quiet -q \ + -batch -fullname -f -b && ret=0 + (( ret )) || return 0 + done fi else prev="$words[CURRENT-1]" @@ -31,10 +34,9 @@ else (-[csx]) _files && return 0 ;; (-e) _description files expl executable _files "$expl[@]" -g '*(-*)' && return 0 ;; - (-b) _wanted -V values expl 'baud rate' && - compadd "$expl[@]" 0 50 75 110 134 150 200 300 600 1200 1800 \ - 2400 4800 9600 19200 38400 57600 115200 \ - 230400 && return 0 ;; + (-b) _wanted -V values expl 'baud rate' \ + compadd 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \ + 9600 19200 38400 57600 115200 230400 && return 0 ;; esac w=( "${(@)words[2,-1]}" ) diff --git a/Completion/User/_getconf b/Completion/User/_getconf index 7ce709588..3a635368f 100644 --- a/Completion/User/_getconf +++ b/Completion/User/_getconf @@ -1,20 +1,19 @@ #compdef getconf -local expl +local expl ret=1 if [[ CURRENT -eq 2 ]]; then _tags syswideconfig pathconfig standardsconfig while _tags; do - if _requested -V syswideconfig expl 'systemwide configuration variables' - then - compadd "$expl[@]" -S '' ARG_MAX BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX \ + _requested -V syswideconfig expl 'systemwide configuration variables' \ + compadd -S '' ARG_MAX BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX \ BC_STRING_MAX CHILD_MAX COLL_WEIGHTS_MAX EXPR_NEST_MAX LINE_MAX \ - NGROUPS_MAX OPEN_MAX RE_DUP_MAX STREAM_MAX TZNAME_MAX - fi - if _requested -V standardsconfig \ - expl 'system-standards configuration variables'; then - compadd "$expl[@]" -S '' _POSIX_CHILD_MAX _POSIX_LINK_MAX \ + NGROUPS_MAX OPEN_MAX RE_DUP_MAX STREAM_MAX TZNAME_MAX && ret=0 + + _requested -V standardsconfig \ + expl 'system-standards configuration variables' \ + compadd -S '' _POSIX_CHILD_MAX _POSIX_LINK_MAX \ _POSIX_MAX_CANON _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX \ _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SSIZE_MAX \ _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VERSION \ @@ -22,15 +21,17 @@ if [[ CURRENT -eq 2 ]]; then POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX POSIX2_EXPR_NEST_MAX \ POSIX2_LINE_MAX POSIX2_RE_DUP_MAX POSIX2_VERSION POSIX2_C_BIND \ POSIX2_C_DEV POSIX2_FORT_DEV POSIX2_FORT_RUN POSIX2_LOCALEDEF \ - POSIX2_SW_DEV _XOPEN_VERSION - fi - if _requested -V pathconfig expl 'system path configuration variables' - then - compadd "$expl[@]" -S '' PIPE_BUF _POSIX_CHOWN_RESTRICTED \ - _POSIX_NO_TRUNC _POSIX_VDISABLE - compadd "$expl[@]" -S ' ' LINK_MAX MAX_CANON MAX_INPUT NAME_MAX PATH_MAX \ - PIPE_BUF - fi + POSIX2_SW_DEV _XOPEN_VERSION && ret=0 + + _requested pathconfig && + while _try -V pathconfig expl 'system path configuration variables'; do + compadd "$expl[@]" -S '' PIPE_BUF _POSIX_CHOWN_RESTRICTED \ + _POSIX_NO_TRUNC _POSIX_VDISABLE && ret=0 + compadd "$expl[@]" -S ' ' LINK_MAX MAX_CANON MAX_INPUT NAME_MAX \ + PATH_MAX PIPE_BUF && ret=0 + (( ret )) || break + done + (( ret )) || return 0 done else _files -/ diff --git a/Completion/User/_gprof b/Completion/User/_gprof index 80de70bb4..67fbb99eb 100644 --- a/Completion/User/_gprof +++ b/Completion/User/_gprof @@ -17,7 +17,7 @@ _arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \ if [[ -n "$state" ]]; then local cmd pair expl - _tags functions || return 1 + _wanted functions || return 1 [[ "$state" = pair ]] && pair=yes diff --git a/Completion/User/_groups b/Completion/User/_groups index 185b06549..748536f3b 100644 --- a/Completion/User/_groups +++ b/Completion/User/_groups @@ -2,7 +2,7 @@ local expl groups tmp -_wanted groups expl group || return 1 +_wanted groups || return 1 if ! zstyle -a ":completion:${curcontext}:" groups groups; then (( $+_cache_groups )) || @@ -16,4 +16,4 @@ if ! zstyle -a ":completion:${curcontext}:" groups groups; then groups=( "$_cache_groups[@]" ) fi -compadd "$@" "$expl[@]" - "$groups[@]" +_loop groups expl group compadd "$@" - "$groups[@]" diff --git a/Completion/User/_gs b/Completion/User/_gs index 8ae5a65f9..52345cdbb 100644 --- a/Completion/User/_gs +++ b/Completion/User/_gs @@ -25,8 +25,8 @@ else if [[ "$PREFIX" = *\=* ]]; then _message 'systemdict definition value' else - _wanted names expl 'systemdict definition name' && - compadd "$expl[@]" -M 'm:{a-z}={A-Z}' - \ + _wanted names expl 'systemdict definition name' \ + compadd -M 'm:{a-z}={A-Z}' - \ DISKFONTS NOCACHE NOBIND NODISPLAY NOPAUSE PLATFONTS SAFER \ WRITESYSTEMDICT && ret=0 fi @@ -35,8 +35,8 @@ else if compset -P '*='; then case "$IPREFIX" in *DEVICE\=) - _wanted devices expl 'ghostscript device' && - compadd "$expl[@]" - "${(@)${=${$(_call devices gs -h)##* devices:}%%Search path:*}:#}" && ret=0 + _wanted devices expl 'ghostscript device' \ + compadd - "${(@)${=${$(_call devices gs -h)##* devices:}%%Search path:*}:#}" && ret=0 ;; *OutputFile\=) _description files expl 'output file' @@ -47,9 +47,8 @@ else return 1 esac else - _wanted names expl 'systemdict name' && - compadd "$expl[@]" -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && - ret=0 + _wanted names expl 'systemdict name' \ + compadd -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && ret=0 fi ;; esac diff --git a/Completion/User/_hosts b/Completion/User/_hosts index cab65329c..c90493d21 100644 --- a/Completion/User/_hosts +++ b/Completion/User/_hosts @@ -9,5 +9,5 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then hosts=( "$_cache_hosts[@]" ) fi -_wanted hosts expl host && - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$hosts[@]" +_wanted hosts expl host \ + compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" - "$hosts[@]" diff --git a/Completion/User/_lp b/Completion/User/_lp index 51fbb1616..3ff814cbb 100644 --- a/Completion/User/_lp +++ b/Completion/User/_lp @@ -36,14 +36,15 @@ if (( ! $+_lp_cache )); then fi if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then - if _wanted printers expl printer; then + if _wanted printers; then if zstyle -T ":completion:${curcontext}:printers" verbose; then zformat -a list ' -- ' "$_lp_cache[@]" disp=(-ld list) else disp=() fi - compadd "$expl[@]" "$disp[@]" - "${(@)_lp_cache%%:*}" && return 0 + _loop printers expl printer \ + compadd "$disp[@]" - "${(@)_lp_cache%%:*}" && return 0 (( $+_lp_alias_cache )) || return 1 @@ -70,7 +71,7 @@ else _tags users jobs while _tags; do - if _requested users expl user; then + if _requested users; then strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" ) if [[ -z "$shown" ]] && zstyle -T ":completion:${curcontext}:users" verbose; then @@ -79,9 +80,10 @@ else else disp=() fi - compadd "$expl[@]" "$disp[@]" - "$strs[@]" || _users && ret=0 + _loop users expl user compadd "$disp[@]" - "$strs[@]" || + _users && ret=0 fi - if _requested jobs expl job; then + if _requested jobs; then strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" ) if [[ -z "$shown" ]] && zstyle -T ":completion:${curcontext}:jobs" verbose; then @@ -90,7 +92,7 @@ else else disp=() fi - compadd "$expl[@]" "$disp[@]" - "$strs[@]" && ret=0 + _loop jobs expl job compadd "$disp[@]" - "$strs[@]" && ret=0 fi (( ret )) || return 0 done diff --git a/Completion/User/_mailboxes b/Completion/User/_mailboxes index 3f798c2d7..784bc4e6e 100644 --- a/Completion/User/_mailboxes +++ b/Completion/User/_mailboxes @@ -2,7 +2,7 @@ _mailboxes() { #emulate -L zsh - local expl nm="$compstate[nmatches]" + local expl ret=1 local pinedirectory="${pinedirectory:-~/mail}" local maildirectory="${maildirectory:-~/Mail}" @@ -40,15 +40,14 @@ _mailboxes() { esac while _tags; do - if _requested mailboxes expl 'mailbox specification'; then - _mua_mailboxes "$expl[@]" - fi + _requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0 + if _requested files expl 'mailbox file'; then [[ "${curcontext}" != *:(mail|mush|zmail|zmlite):* ]] && compset -P -f - _path_files "$expl[@]" + _files "$expl[@]" && ret=0 fi - [[ nm -ne $compstate[nmatches] ]] && return 0 + (( ret )) || return 0 done return 1 @@ -96,6 +95,7 @@ _mua_mailboxes() { local -a mbox_short local -aU mbox_names + local ret=1 case "${curcontext}" in (*:elm:*) # I've probably got this wrong, or at least incomplete @@ -111,7 +111,7 @@ _mua_mailboxes() { fi ;; (*:mh:*) # I've probably got this wrong, or at least incomplete - (( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache + (( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache && ret=0 ;; (*:mush:*) if compset -P %; then @@ -155,7 +155,6 @@ _mua_mailboxes() { ;; esac - local ret=1 (( $#mbox_names )) && _multi_parts "$@" / mbox_names && ret=0 (( $#mbox_short )) && compadd "$@" - "$mbox_short[@]" && ret=0 return ret diff --git a/Completion/User/_make b/Completion/User/_make index aaae444a8..dc08d4e26 100644 --- a/Completion/User/_make +++ b/Completion/User/_make @@ -1,6 +1,6 @@ #compdef make gmake pmake -local prev="$words[CURRENT-1]" file ret=1 expl +local prev="$words[CURRENT-1]" file expl tmp if [[ "$prev" = -[CI] ]]; then _files -/ @@ -18,11 +18,15 @@ else file='' fi - [[ -n "$file" ]] && _wanted targets expl 'make target' && - compadd "$expl[@]" - \ + if [[ -n "$file" ]] && _wanted targets; then + tmp=( $(awk '/^[a-zA-Z0-9][^\/ \t]+:/ {print $1} /^\.include *<bsd\.port\.(subdir\.|pre\.)?mk>/ || /^\.include *".*mk\/bsd\.pkg\.(subdir\.)?mk"/ { print "fetch fetch-list extract patch configure build install reinstall deinstall package describe checkpatch checksum makesum" }' \ - FS=: $file) && ret=0 - (( ret )) && { compset -P 1 '*='; _files } + FS=: $file) + ) + _loop targets expl 'make target' compadd "$tmp[@]" && return 0 + fi + compset -P 1 '*=' + _files fi diff --git a/Completion/User/_man b/Completion/User/_man index 6f62501ee..8ae97962c 100644 --- a/Completion/User/_man +++ b/Completion/User/_man @@ -33,5 +33,5 @@ else rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) ) fi -(( $#rep )) && _wanted manuals expl 'manual page' && - compadd "$expl[@]" - ${rep%%.[^.]##(.gz|.bz2|)} +(( $#rep )) && _wanted manuals expl 'manual page' \ + compadd - ${rep%%.[^.]##(.gz|.bz2|)} diff --git a/Completion/User/_mh b/Completion/User/_mh index f02aee9b5..aacde38a1 100644 --- a/Completion/User/_mh +++ b/Completion/User/_mh @@ -17,13 +17,16 @@ if compset -P 1 -; then # get list of options, which MH commands can generate themselves # awk is just too icky to use for this, sorry. send me one if # you come up with it. - _wanted options expl option && - compadd "$expl[@]" - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { + if _wanted options; then + _loop options expl option \ + compadd - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { $n = $1; $n =~ s/\)//g; print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; }') - return + return + fi + return 1 elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then # Complete folder names. local mhpath @@ -35,7 +38,7 @@ elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then mhpath=$(mhpath) fi - _wanted files expl 'MH folder' && _path_files "$expl[@]" -W mhpath -/ + _wanted files expl 'MH folder' _path_files -W mhpath -/ elif [[ "$prev" = -(editor|(whatnow|rmm|show|more)proc) ]]; then _command_names -e elif [[ "$prev" = -file ]]; then @@ -48,14 +51,11 @@ elif [[ "$prev" = -(form|audit|filter) ]]; then [[ -d $mhlib ]] || { mhlib=$(mhparam mhlproc); mhlib=$mhlib:h; } mhfpath=($mymhdir $mhlib) - _wanted files expl 'MH template file' && - _files "$expl[@]" -W mhfpath -g '*(.)' + _wanted files expl 'MH template file' _files -W mhfpath -g '*(.)' elif [[ "$prev" = -(no|)cc ]]; then - _wanted -C "$prev" values expl 'CC address' && - compadd "$expl[@]" all to cc me + _wanted -C "$prev" values expl 'CC address' compadd all to cc me elif [[ "$prev" = -[rw]cache ]]; then - _wanted -C "$prev" values expl cache && - compadd "$expl[@]" public private never ask + _wanted -C "$prev" values expl cache compadd public private never ask else # Generate sequences. local foldnam folddir f ret @@ -72,11 +72,14 @@ else # leaving foldnam empty works here fi - if _wanted sequences expl sequence; then - compadd "$expl[@]" $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') && + if _wanted sequences; then + while _try sequences expl sequence; do + compadd "$expl[@]" $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') && ret=0 - compadd "$expl[@]" reply next cur prev first last all unseen && ret=0 - _files "$expl[@]" -W folddir -g '<->' && ret=0 + compadd "$expl[@]" reply next cur prev first last all unseen && ret=0 + _files "$expl[@]" -W folddir -g '<->' && ret=0 + (( ret )) || return 0 + done fi return ret fi diff --git a/Completion/User/_mount b/Completion/User/_mount index 23b2a6378..00fb00fb5 100644 --- a/Completion/User/_mount +++ b/Completion/User/_mount @@ -539,11 +539,11 @@ case "$state" in fstype) compset -P '*,' - _wanted types expl 'file system type' && + _wanted types expl 'file system type' \ compadd "$expl[@]" -qS, -M 'L:|no=' - "$fss[@]" && ret=0 ;; fsopt) - _tags options || return 1 + _wanted options || return 1 eval 'tmp=(' '"$_fs_'${(s:,:)^${opt_args[$typeops]:-${deffs}}}'[@]"' ')' tmp=( "$_fs_any[@]" "${(@)tmp:#}" ) diff --git a/Completion/User/_mutt b/Completion/User/_mutt index 90e7dec08..8df7799ee 100644 --- a/Completion/User/_mutt +++ b/Completion/User/_mutt @@ -25,8 +25,6 @@ local curcontext="$curcontext" state line ret=1 '-Z+:open first mailbox with new mail:' && ret=0 if [[ "$state" = userhost ]]; then - _tags hosts || return 1 - if compset -P '*@'; then _description hosts expl 'remote host name' _hosts "$expl[@]" -q -S, && return 0 diff --git a/Completion/User/_mysql_utils b/Completion/User/_mysql_utils index 6d777112d..77ed7a36e 100644 --- a/Completion/User/_mysql_utils +++ b/Completion/User/_mysql_utils @@ -24,33 +24,33 @@ _mysql_hosts () { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity - _wanted hosts expl 'server host' && + _wanted hosts expl 'server host' \ _combination -s '[:@]' '' hosts-ports-users \ ${_mysql_user:+users=${_mysql_user:q}} \ ${_mysql_port:+ports=${_mysql_port:q}} \ - hosts "$expl[@]" + hosts - } _mysql_ports () { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity - _wanted ports expl 'server port' && + _wanted ports expl 'server port' \ _combination -s '[:@]' '' hosts-ports-users \ ${_mysql_user:+users=${_mysql_user:q}} \ ${_mysql_host:+hosts=${_mysql_host:q}} \ - ports "$expl[@]" + ports - } _mysql_users () { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity - _wanted users expl 'server username' && + _wanted users expl 'server username' \ _combination -s '[:@]' '' hosts-ports-users \ ${_mysql_host:+hosts=${_mysql_host:q}} \ ${_mysql_port:+ports=${_mysql_port:q}} \ - users "$expl[@]" + users - } _mysql_databases () { @@ -205,15 +205,13 @@ _mysqladmin_commands () { ) if (( CURRENT == 1 )); then - _tags commands && compadd "$@" $cmds + _wanted commands expl command compadd "$@" - $cmds else local curcontext="$curcontext" case "$words[1]" in - (create) - ;& - (drop) - _wanted mysqldbs expl "MySQL databases" && _mysql_databases + (create|drop) + _wanted mysqldbs expl "MySQL databases" _mysql_databases ;; (kill) _message 'thread ids' diff --git a/Completion/User/_netscape b/Completion/User/_netscape index 23601de12..715ca408a 100644 --- a/Completion/User/_netscape +++ b/Completion/User/_netscape @@ -40,30 +40,31 @@ if [[ "$state" = "remote" ]]; then openFile*) _files -W ~;; saveAs*) if compset -P "*,"; then - _wanted types expl 'data type' && + _wanted types expl 'data type' \ compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript && ret=0 else - _tags files && _path_files -W ~ && ret=0 + _files -W ~ && ret=0 fi ;; mailto*) compset -P "*," if compset -P '*@'; then - _wanted hosts expl 'remote host name' && - _hosts "$expl[@]" -q -S, && ret=0 + _wanted hosts expl 'remote host name' _hosts -q -S, && ret=0 else - _wanted users expl 'login name' && _users "$expl[@]" -q -S@ && ret=0 + _wanted users expl 'login name' _users -q -S@ && ret=0 fi ;; *) - if _wanted commands expl 'remote commands'; then + if _wanted commands; then if [[ -z "$QIPREFIX" ]]; then - compadd "$expl[@]" -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' - \ - $remote_commands && ret=0 + _loop commands expl 'remote commands' \ + compadd -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' - \ + $remote_commands && ret=0 else - compadd "$expl[@]" -qS '(' -M 'm:{a-zA-Z}={A-Za-z}' - \ - $remote_commands && ret=0 + _loop commands expl 'remote commands' \ + compadd -qS '(' -M 'm:{a-zA-Z}={A-Za-z}' - \ + $remote_commands && ret=0 fi fi ;; @@ -73,14 +74,16 @@ fi if [[ "$state" = "urls" ]]; then # Complete netscape urls if compset -P about: ; then - _wanted values expl 'about what' && + _wanted values expl 'about what' \ compadd authors blank cache document fonts global hype image-cache \ license logo memory-cache mozilla plugins && ret=0 else - if _tags prefixes; then - _description prefixes expl 'URL prefix' - compadd "$expl[@]" -S '' about: mocha: javascript: - _urls "$@" && ret=0 + if _wanted prefixes; then + while _try prefixes expl 'URL prefix'; do + compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0 + _urls "$@" && ret=0 + (( ret )) || return 0 + done fi fi fi diff --git a/Completion/User/_nslookup b/Completion/User/_nslookup index 7c67cb256..fc14df18c 100644 --- a/Completion/User/_nslookup +++ b/Completion/User/_nslookup @@ -60,7 +60,7 @@ if [[ -n "$compcontext" ]]; then _funcall ret _nslookup_redirect && return ret - _tags -C redirection files || return 1 + _wanted -C redirection files || return 1 if [[ "$words[1]" != (finger|ls) ]]; then _message "redirection not allowed for command \`$words[1]'" @@ -86,7 +86,7 @@ if [[ -n "$compcontext" ]]; then case "$words[1]" in (|l)server) - _wanted hosts expl 'new default server' && _hosts "$expl[@]" + _wanted hosts expl 'new default server' _hosts return ;; root|exit|help|\?) @@ -119,7 +119,7 @@ if [[ -n "$compcontext" ]]; then [[ -z "$state" ]] && return ret ;; *) - _wanted hosts expl 'server' && _hosts "$expl[@]" + _wanted hosts expl 'server' _hosts return esac fi diff --git a/Completion/User/_pbm b/Completion/User/_pbm index 2c12505ee..1f740ad31 100644 --- a/Completion/User/_pbm +++ b/Completion/User/_pbm @@ -254,7 +254,7 @@ pgmtoppm) fi _x_color && ret=0 - _wanted options expl option && compadd "$expl[@]" - -map && ret=0 + _wanted options expl option compadd - -map && ret=0 return ret elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then @@ -590,12 +590,11 @@ ppmquant) fi if [[ CURRENT -eq 2 ]]; then - _wanted options expl option && - if [[ -n "$opt" ]]; then - compadd "$expl[@]" - -map -fs -floyd && ret=0 - else - compadd "$expl[@]" - -map && ret=0 - fi + if [[ -n "$opt" ]]; then + _wanted options expl option compadd - -map -fs -floyd && ret=0 + else + _wanted options expl option compadd - -map && ret=0 + fi _message 'number of colors' return ret diff --git a/Completion/User/_perl_basepods b/Completion/User/_perl_basepods index 7f257aed3..f5b2216c1 100644 --- a/Completion/User/_perl_basepods +++ b/Completion/User/_perl_basepods @@ -29,5 +29,4 @@ fi local expl -_wanted pods expl 'Perl base pods' && - compadd "$expl[@]" - $_perl_basepods +_wanted pods expl 'Perl base pods' compadd - $_perl_basepods diff --git a/Completion/User/_perl_builtin_funcs b/Completion/User/_perl_builtin_funcs index 7ac69828d..8c221f5a6 100644 --- a/Completion/User/_perl_builtin_funcs +++ b/Completion/User/_perl_builtin_funcs @@ -28,5 +28,4 @@ fi local expl -_wanted functions expl 'Perl built-in functions' && - compadd "$expl[@]" - $_perl_builtin_funcs +_wanted functions expl 'Perl built-in functions' compadd - $_perl_builtin_funcs diff --git a/Completion/User/_perl_modules b/Completion/User/_perl_modules index 8f6a5b882..d1701f57a 100644 --- a/Completion/User/_perl_modules +++ b/Completion/User/_perl_modules @@ -49,4 +49,4 @@ fi local expl -_wanted modules expl 'Perl modules' && compadd "$expl[@]" "$opts[@]" - $_perl_modules +_wanted modules expl 'Perl modules' compadd "$opts[@]" - $_perl_modules diff --git a/Completion/User/_ports b/Completion/User/_ports index 6780067b3..e2db41960 100644 --- a/Completion/User/_ports +++ b/Completion/User/_ports @@ -9,4 +9,4 @@ if ! zstyle -a ":completion:${curcontext}:" ports ports; then ports=( "$_cache_ports[@]" ) fi -_wanted ports expl port && compadd "$@" "$expl[@]" - "$ports[@]" +_wanted ports expl port compadd "$@" - "$ports[@]" diff --git a/Completion/User/_rcs b/Completion/User/_rcs index 0831b1d0b..6c4a1d9d6 100644 --- a/Completion/User/_rcs +++ b/Completion/User/_rcs @@ -8,5 +8,5 @@ if [[ $compstate[nmatches] -eq nm && -d RCS && $words[1] != ci ]]; then local rep expl rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//)) - (( $#rep )) && _wanted files expl 'RCS file' && compadd "$expl[@]" - $rep + (( $#rep )) && _wanted files expl 'RCS file' compadd - $rep fi diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin index df78bd447..2c5e9bfc0 100644 --- a/Completion/User/_rlogin +++ b/Completion/User/_rlogin @@ -40,7 +40,7 @@ _rlogin () { if compset -P '*:'; then _files && ret=0 elif compset -P '*@'; then - _tags hosts && _rlogin_hosts -S: -q && ret=0 + _wanted hosts && _rlogin_hosts -S: -q && ret=0 else _alternative \ 'files:: _files' \ @@ -54,11 +54,11 @@ _rlogin () { } _rlogin_users () { - _tags users && _combination -s '[:@]' my-accounts users-hosts users "$@" + _wanted users && _combination -s '[:@]' my-accounts users-hosts users "$@" } _rlogin_hosts () { - _tags hosts && + _wanted hosts && if [[ "$IPREFIX" == *@ ]]; then _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" else diff --git a/Completion/User/_socket b/Completion/User/_socket index dfe8f4844..fecd3e6c0 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -39,17 +39,16 @@ command) arg1) if (( $+opt_args[-s] )); then - _wanted ports expl 'port to listen' && _ports "$expl[@]" + _wanted ports expl 'port to listen' _ports else - _wanted hosts expl 'host' && - _combination '' hosts-ports hosts "$expl[@]" + _wanted hosts expl 'host' _combination '' hosts-ports hosts - fi ;; arg2) if (( ! $+opt_args[-s] )); then - _wanted ports expl 'port to connect' && - _combination '' hosts-ports hosts="${line[1]:q}" ports "$expl[@]" + _wanted ports expl 'port to connect' \ + _combination '' hosts-ports hosts="${line[1]:q}" ports - fi ;; esac diff --git a/Completion/User/_ssh b/Completion/User/_ssh index ddfe6de63..6748a270e 100644 --- a/Completion/User/_ssh +++ b/Completion/User/_ssh @@ -54,21 +54,18 @@ _ssh () { if compset -P '*[= ]'; then case "$IPREFIX" in *(#i)(batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|usepriviledgedport)*) - _wanted values expl 'truth value' && compadd "$expl[@]" yes no && - ret=0 + _wanted values expl 'truth value' compadd yes no && ret=0 ;; *(#i)cipher*) - _wanted values expl 'encryption cipher' && - compadd "$expl[@]" idea des 3des blowfish arcfour tss none && \ - ret=0 + _wanted values expl 'encryption cipher' \ + compadd idea des 3des blowfish arcfour tss none && ret=0 ;; *(#i)globalknownhostsfile*) _description files expl 'global file with known hosts' _files "$expl[@]" && ret=0 ;; *(#i)hostname*) - _wanted hosts expl 'real host name to log into' && - _ssh_hosts "$expl[@]" && ret=0 + _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 ;; *(#i)identityfile*) _description files expl 'SSH identity file' @@ -84,16 +81,14 @@ _ssh () { _normal && ret=0 ;; *(#i)stricthostkeychecking*) - _wanted values expl 'checking type' && - compadd "$expl[@]" yes no ask + _wanted values expl 'checking type' compadd yes no ask && ret=0 ;; *(#i)userknownhostsfile*) _description files expl 'user file with known hosts' _files "$expl[@]" && ret=0 ;; *(#i)user*) - _wanted users expl 'user to log in as' && - _ssh_users "$expl[@]" && ret=0 + _wanted users expl 'user to log in as' _ssh_users && ret=0 ;; *(#i)xauthlocation*) _description files expl 'xauth program' @@ -101,8 +96,8 @@ _ssh () { ;; esac else - _wanted values expl 'configure file option' && - compadd "$expl[@]" -M 'm:{a-z}={A-Z}' -S '=' - \ + _wanted values expl 'configure file option' \ + compadd -M 'm:{a-z}={A-Z}' -S '=' - \ BatchMode ClearAllForwardings Cipher Compression \ CompressionLevel Host ConnectionAttempts EscapeChar \ FallBackToRsh ForwardAgent ForwardX11 \ @@ -121,7 +116,7 @@ _ssh () { if compset -P '*:'; then _message 'port number' else - _wanted hosts expl host && _ssh_hosts -qS: "$expl[@]" + _wanted hosts expl host _ssh_hosts -qS: fi else _message 'listen-port number' @@ -136,8 +131,7 @@ _ssh () { ;; userhost) if compset -P '*@'; then - _wanted hosts expl 'remote host name' && - _ssh_hosts "$expl[@]" && ret=0 + _wanted hosts expl 'remote host name' _ssh_hosts && ret=0 else if (( $+opt_args[-l] )); then tmp=() @@ -180,7 +174,7 @@ _ssh () { if compset -P '*:'; then _remote_files && ret=0 elif compset -P '*@'; then - _wanted hosts expl host && _ssh_hosts -S: "$expl[@]" && ret=0 + _wanted hosts expl host _ssh_hosts -S: && ret=0 else _alternative \ 'files:: _files' \ diff --git a/Completion/User/_stty b/Completion/User/_stty index 06d0bf851..f40cd856e 100644 --- a/Completion/User/_stty +++ b/Completion/User/_stty @@ -4,18 +4,15 @@ local expl if [[ "$words[CURRENT-1]" = \ (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]]; then - _wanted characters expl 'control character' && - compadd "$expl[@]" '^-' '^h' '^?' '^c' '^u' + _wanted characters expl 'control character' compadd '^-' '^h' '^?' '^c' '^u' else compset -P '[-+]' - _wanted values expl setting && - compadd "$expl[@]" rows columns intr quit erase kill eof eol \ - eol2 start stop susp dsusp reprint discard \ - werase lnext parenb parodd cs8 cstopb hupcl \ - cread clocal parext ignbrk brkint ignpar \ - parmrk inpck istrip inlcr igncr icrnl iuclc \ - ixon ixany ixoff imaxbel isig icanon xcase \ - echo echoe echok echonl noflsh tostop echoctl \ - echoprt echoke flusho pending iexten opost \ - olcuc onlcr ocrnl onocr onlret ofill ofdel + _wanted values expl setting \ + compadd rows columns intr quit erase kill eof eol eol2 start stop \ + susp dsusp reprint discard werase lnext parenb parodd cs8 \ + cstopb hupcl cread clocal parext ignbrk brkint ignpar \ + parmrk inpck istrip inlcr igncr icrnl iuclc ixon ixany ixoff \ + imaxbel isig icanon xcase echo echoe echok echonl noflsh \ + tostop echoctl echoprt echoke flusho pending iexten opost \ + olcuc onlcr ocrnl onocr onlret ofill ofdel fi diff --git a/Completion/User/_tar b/Completion/User/_tar index ac23e94f3..6ca1c27bf 100644 --- a/Completion/User/_tar +++ b/Completion/User/_tar @@ -142,8 +142,7 @@ elif [[ ( "$_tar_cmd" = *[xt]* || -n $del ) && -n "$tf" ]]; then _tar_cache_name=$tf fi - _wanted files expl 'file from archive' && - _multi_parts "$expl[@]" / _tar_cache_list + _wanted files expl 'file from archive' _multi_parts / _tar_cache_list else _files fi diff --git a/Completion/User/_telnet b/Completion/User/_telnet index 2542ff34d..02a30f138 100644 --- a/Completion/User/_telnet +++ b/Completion/User/_telnet @@ -46,25 +46,25 @@ _arguments -C -s \ case "$state" in hosts) - _wanted hosts expl host && + _wanted hosts expl host \ _combination -s '[@:]' '' users-hosts-ports \ ${opt_args[-l]:+users=${opt_args[-l]:q}} \ - hosts "$expl[@]" + hosts - ;; ports) - _wanted ports expl port && + _wanted ports expl port \ _combination -s '[@:]' '' users-hosts-ports \ ${opt_args[-l]:+users=${opt_args[-l]:q}} \ hosts="${line[1]:q}" \ - ports "$expl[@]" + ports - ;; users) - _wanted users expl user && + _wanted users expl user \ _combination -s '[@:]' '' users-hosts-ports \ ${line[2]:+hosts="${line[2]:q}"} \ ${line[3]:+ports="${line[3]:q}"} \ - users "$expl[@]" + users - ;; esac diff --git a/Completion/User/_tiff b/Completion/User/_tiff index a0fb0d4b4..5f7cc7edb 100644 --- a/Completion/User/_tiff +++ b/Completion/User/_tiff @@ -194,9 +194,12 @@ if [[ -n "$state" ]]; then ;; esac else - if _wanted values expl 'compression scheme'; then - compadd "$expl[@]" - none g4 packbits && ret=0 - compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0 + if _wanted values; then + while _try values expl 'compression scheme'; do + compadd "$expl[@]" - none g4 packbits && ret=0 + compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0 + (( ret )) || return 0 + done fi fi fi diff --git a/Completion/User/_urls b/Completion/User/_urls index 3f2cab789..369017677 100644 --- a/Completion/User/_urls +++ b/Completion/User/_urls @@ -49,16 +49,18 @@ local localhttp_userdir="$localhttp[3]" if [[ "$1" = -f ]]; then shift - _tags -C -f files && _files "$@" && return + _wanted -C -f files && _files "$@" && return fi ipre="$IPREFIX" -if ! compset -P '(#b)([-+.a-z0-9]#):' && - _wanted -C argument prefixes expl 'URL prefix'; then - [[ -d $urls_path/bookmark ]] && - compadd "$@" "$expl[@]" -S '' bookmark: && ret=0 - compadd "$@" "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0 +if ! compset -P '(#b)([-+.a-z0-9]#):' && _wanted -C argument prefixes; then + while _try prefixes expl 'URL prefix' "$@"; do + [[ -d $urls_path/bookmark ]] && + compadd "$expl[@]" -S '' bookmark: && ret=0 + compadd "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0 + (( ret )) || return 0 + done return ret fi scheme="$match[1]" @@ -66,35 +68,40 @@ scheme="$match[1]" case "$scheme" in http|ftp|gopher) if ! compset -P //; then - _wanted -C "$scheme" prefixes expl 'end of prefix' && - compadd "$expl[@]" "$@" -S '' // + _wanted -C "$scheme" prefixes expl 'end of prefix' compadd "$@" -S '' // return fi ;; file) if ! compset -P //; then - _wanted -C file files expl 'local file' || return 1 + _wanted -C file files || return 1 - if [[ -prefix / ]]; then - _path_files "$expl[@]" "$@" -S '' -g '*(^/)' && ret=0 - _path_files "$expl[@]" "$@" -S/ -r '/' -/ && ret=0 - elif [[ -z "$PREFIX" ]]; then - compadd "$expl[@]" -S '/' -r '/' - "${PWD%/}" && ret=0 - fi + while _try files expl 'local file' "$@"; do + if [[ -prefix / ]]; then + _path_files "$expl[@]" -S '' -g '*(^/)' && ret=0 + _path_files "$expl[@]" -S/ -r '/' -/ && ret=0 + elif [[ -z "$PREFIX" ]]; then + compadd "$expl[@]" -S '/' -r '/' - "${PWD%/}" && ret=0 + fi + (( ret )) || return 0 + done return ret fi ;; bookmark) if [[ -f "$urls_path/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" && -s "$urls_path/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" ]]; then - _wanted -C bookmark bookmarks expl bookmarks && - compadd "$expl[@]" "$@" -U - \ + _wanted -C bookmark bookmarks expl bookmarks \ + compadd "$@" -U - \ "$ipre$(<"$urls_path/$scheme/${(Q)PREFIX}${(Q)SUFFIX}")" && ret=0 else - if _wanted -C bookmark files expl 'bookmark'; then - _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && - ret=0 - _path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0 + if _wanted -C bookmark files; then + while _try files expl 'bookmark'; do + _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && + ret=0 + _path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0 + (( ret )) || return 0 + done fi fi return ret @@ -102,19 +109,22 @@ case "$scheme" in esac # Complete hosts -if ! compset -P '(#b)([^/]#)/' && - _wanted hosts expl host; then +if ! compset -P '(#b)([^/]#)/' && _wanted hosts; then uhosts=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t)) - (( $#uhosts )) || _hosts -S/ && ret=0 - [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername) - compadd "$expl[@]" "$@" -S/ - $uhosts && ret=0 + + while _try hosts expl host "$@"; do + (( $#uhosts )) || _hosts -S/ && ret=0 + [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername) + compadd "$expl[@]" -S/ - $uhosts && ret=0 + (( ret )) || return 0 + done return ret fi host="$match[1]" # Complete part after hostname -_wanted -C local files expl 'local file' || return 1 +_wanted -C local files || return 1 if [[ "$localhttp_servername" = "$host" ]]; then if compset -P \~; then @@ -123,14 +133,23 @@ if [[ "$localhttp_servername" = "$host" ]]; then return fi user="$match[1]" - _path_files "$expl[@]" -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0 - _path_files "$expl[@]" -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0 + while _try files expl 'local file'; do + _path_files "$expl[@]" -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0 + _path_files "$expl[@]" -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0 + (( ret )) || return 0 + done else - _path_files "$expl[@]" -W $localhttp_documentroot -g '*(^/)' && ret=0 - _path_files "$expl[@]" -W $localhttp_documentroot -S/ -r '/' -/ && ret=0 + while _try files expl 'local file'; do + _path_files "$expl[@]" -W $localhttp_documentroot -g '*(^/)' && ret=0 + _path_files "$expl[@]" -W $localhttp_documentroot -S/ -r '/' -/ && ret=0 + (( ret )) || return 0 + done fi else - _path_files "$expl[@]" -W $urls_path/$scheme/$host -g '*(^/)' && ret=0 - _path_files "$expl[@]" -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0 + while _try files expl 'local file'; do + _path_files "$expl[@]" -W $urls_path/$scheme/$host -g '*(^/)' && ret=0 + _path_files "$expl[@]" -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0 + (( ret )) || return 0 + done fi return $ret diff --git a/Completion/User/_user_at_host b/Completion/User/_user_at_host index c7b86d385..785d79932 100644 --- a/Completion/User/_user_at_host +++ b/Completion/User/_user_at_host @@ -22,9 +22,9 @@ if [[ -prefix 1 *@ ]]; then compset -P 1 '*@' - _wanted -C user-at hosts expl "host for $user" && - _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$expl[@]" "$@" + _wanted -C user-at hosts expl "host for $user" \ + _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" - else - _wanted users expl "user" && - _combination -s '[:@]' "${tag}" users-hosts users -S@ -q "$expl[@]" "$@" + _wanted users expl "user" \ + _combination -s '[:@]' "${tag}" users-hosts users -S@ -q "$@" - fi diff --git a/Completion/User/_users b/Completion/User/_users index da5539556..0457ecabf 100644 --- a/Completion/User/_users +++ b/Completion/User/_users @@ -2,9 +2,9 @@ local expl users -_wanted users expl user || return 1 +_wanted users || return 1 zstyle -a ":completion:${curcontext}:" users users && - compadd "$expl[@]" "$@" - "$users[@]" && return 0 + _loop users expl user compadd "$@" - "$users[@]" && return 0 -compadd "$@" "$expl[@]" - "${(@k)userdirs}" +_loop users expl user compadd "$@" - "${(@k)userdirs}" diff --git a/Completion/User/_users_on b/Completion/User/_users_on index f620f83c7..04a834d53 100644 --- a/Completion/User/_users_on +++ b/Completion/User/_users_on @@ -2,11 +2,11 @@ local expl -_tags users || return 1 +_wanted users || return 1 if which users >/dev/null; then - _description users expl 'users logged on' - compadd "$@" "$expl[@]" - $(_call users users) && return 0 + _loop users expl 'users logged on' \ + compadd "$@" - $(_call users users) && return 0 else # Other methods of finding out users logged on should be added here return 1 diff --git a/Completion/User/_whois b/Completion/User/_whois index 0d2675d47..ffdbc13f9 100644 --- a/Completion/User/_whois +++ b/Completion/User/_whois @@ -189,14 +189,14 @@ _whois_fwhois () { } _whois_hosts () { - _tags hosts && + _wanted hosts && compadd "$@" \ -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' \ - ${_whois_servers%:?} || _hosts "$@" } _whois_ports () { - _tags ports && compadd "$@" - whois || _ports "$@" + _wanted ports && compadd "$@" - whois || _ports "$@" } (( $+functions[_whois:whois.internic.net] )) || @@ -204,7 +204,7 @@ _whois:whois.internic.net () { if (( CURRENT == 1 )); then local expl - _wanted strings expl string && compadd "$expl[@]" HELP DOMAIN HOST + _wanted strings expl string compadd HELP DOMAIN HOST else _message 'string' fi @@ -215,7 +215,7 @@ _whois:whois.nic.ad.jp () { if (( CURRENT == 1 )); then local expl - _wanted strings expl string && compadd HELP DOM NET HOST PERSON CONN COM + _wanted strings expl string compadd HELP DOM NET HOST PERSON CONN COM else _message 'string' fi diff --git a/Completion/User/_yp b/Completion/User/_yp index fe3c0a482..4b1b031b3 100644 --- a/Completion/User/_yp +++ b/Completion/User/_yp @@ -95,15 +95,16 @@ if [[ "$state" = map* ]]; then while _tags; do # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'. - _requested maps expl 'map name' && - compadd "$expl[@]" -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \ + _requested maps expl 'map name' \ + compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \ "$_yp_cache_maps[@]" && ret=0 - _requested nicknames expl nicknames && - compadd "$expl[@]" - "$_yp_cache_nicks[@]" && ret=0 + _requested nicknames expl nicknames \ + compadd - "$_yp_cache_nicks[@]" && ret=0 + (( ret )) || return 0 done elif [[ "$state" = servers ]]; then if compset -P '*,'; then - _wanted hosts expl server && _hosts -qS, && ret=0 + _wanted hosts expl server _hosts -qS, && ret=0 else _message 'domain name' fi |