diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/AIX/_lsdev | 2 | ||||
-rw-r--r-- | Completion/Builtins/_bindkey | 3 | ||||
-rw-r--r-- | Completion/Builtins/_compdef | 3 | ||||
-rw-r--r-- | Completion/Builtins/_zcompile | 4 | ||||
-rw-r--r-- | Completion/Builtins/_zpty | 3 | ||||
-rw-r--r-- | Completion/Builtins/_zstyle | 2 | ||||
-rw-r--r-- | Completion/User/_archie | 23 | ||||
-rw-r--r-- | Completion/User/_bzip2 | 10 | ||||
-rw-r--r-- | Completion/User/_compress | 15 | ||||
-rw-r--r-- | Completion/User/_enscript | 7 | ||||
-rw-r--r-- | Completion/User/_finger | 4 | ||||
-rw-r--r-- | Completion/User/_gzip | 8 | ||||
-rw-r--r-- | Completion/User/_imagemagick | 4 | ||||
-rw-r--r-- | Completion/User/_look | 11 | ||||
-rw-r--r-- | Completion/User/_lynx | 205 | ||||
-rw-r--r-- | Completion/User/_lzop | 4 | ||||
-rw-r--r-- | Completion/User/_mutt | 63 | ||||
-rw-r--r-- | Completion/User/_nedit | 11 | ||||
-rw-r--r-- | Completion/User/_nslookup | 3 | ||||
-rw-r--r-- | Completion/User/_socket | 16 | ||||
-rw-r--r-- | Completion/User/_telnet | 85 | ||||
-rw-r--r-- | Completion/User/_wget | 27 | ||||
-rw-r--r-- | Completion/User/_whois | 4 | ||||
-rw-r--r-- | Completion/X/_xauth | 24 |
24 files changed, 303 insertions, 238 deletions
diff --git a/Completion/AIX/_lsdev b/Completion/AIX/_lsdev index 0d249f440..aca78c295 100644 --- a/Completion/AIX/_lsdev +++ b/Completion/AIX/_lsdev @@ -14,7 +14,7 @@ _arguments -C \ '-r[display set of values in a column]:columnname:->columnname' \ '(-P)-S[specify a device state]:device state:(Available Defined Stopped)' \ '-s[specify a device subclass]:device subclass:->subclass' \ - '-t[specify a device type name]:device type name:->devtype' + '-t[specify a device type name]:device type name:->devtype' && return 0 case $state in class) diff --git a/Completion/Builtins/_bindkey b/Completion/Builtins/_bindkey index d1e1f8ab1..cca4f7e64 100644 --- a/Completion/Builtins/_bindkey +++ b/Completion/Builtins/_bindkey @@ -7,7 +7,8 @@ # # Where appropriate, will complete keymaps instead of widgets. -local state expl line +local state expl line curcontext="$curcontext" +typeset -A opt_args _arguments -C -s \ '(-v -a -M -l -D -A -N)-e[select emacs keymap and bind it to main]' \ diff --git a/Completion/Builtins/_compdef b/Completion/Builtins/_compdef index 649daa6dc..180df920d 100644 --- a/Completion/Builtins/_compdef +++ b/Completion/Builtins/_compdef @@ -1,6 +1,7 @@ #compdef compdef -local state line expl list disp +local state line expl list disp curcontext="$curcontext" +typeset -A opt_args _arguments -C -s \ '(-d)-a[make function autoloadable]' \ diff --git a/Completion/Builtins/_zcompile b/Completion/Builtins/_zcompile index af2b2553e..b4428e019 100644 --- a/Completion/Builtins/_zcompile +++ b/Completion/Builtins/_zcompile @@ -1,9 +1,9 @@ #compdef zcompile -local context state line expl +local state line expl curcontext="$curcontext" typeset -A opt_args -_arguments -s \ +_arguments -C -s \ '(-t -c -m -a)-U[don'\''t expand aliases]' \ '(-t -M)-R[mark as read]' \ '(-t -R)-M[mark as mapped]' \ diff --git a/Completion/Builtins/_zpty b/Completion/Builtins/_zpty index e766e509e..f3e271342 100644 --- a/Completion/Builtins/_zpty +++ b/Completion/Builtins/_zpty @@ -1,6 +1,7 @@ #compdef zpty -local state line list names expl +local state line list names expl curcontext="$curcontext" +typeset -A opt_args _arguments -C -s \ '(-d -w -r -L)-e[echo input characters]' \ diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 1edd0987f..b2bd1d5a8 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -92,7 +92,7 @@ parameters path-directories paths pods ports prefixes processes ps regex sequences sessions signals strings tags targets types urls users values warnings widgets windows zsh-options) -_arguments ':context:->contexts' ':style:->styles' '*:argument:->style-arg' +_arguments -C ':context:->contexts' ':style:->styles' '*:argument:->style-arg' while [[ -n $state ]]; do ostate=$state diff --git a/Completion/User/_archie b/Completion/User/_archie index 92551156e..103fd881a 100644 --- a/Completion/User/_archie +++ b/Completion/User/_archie @@ -1,13 +1,13 @@ #compdef archie -local state line +local curcontext="$curcontext" state line expl typeset -A opt_args -_arguments -s \ - '-D[debug level]' \ +_arguments -C -s \ + '-D+[debug level]:debug level:' \ '-v[print version]' \ '-V[verbose mode]' \ - '-O[specifies offset]:offset:' \ + '-O+[specifies offset]:offset:' \ '-a[list matches as Alex filenames]' \ '-c[case sensitive substring search]' \ '-e[exact string match (default)]' \ @@ -15,16 +15,19 @@ _arguments -s \ '-s[case insensitive substring search]' \ '-l[list one match per line]' \ '-t[sort inverted by date]' \ - '-m[specifies maximum number of hits to return (default 95)]:hits to return:' \ - '-o[specifies file to store results in]:file to store:' \ - '-h[specifies server host]:server host:->serverhost' \ + '-m+[specifies maximum number of hits to return (default 95)]:hits to return:' \ + '-o+[specifies file to store results in]:file to store:' \ + '-h+[specifies server host]:server host:->serverhost' \ '-L[list known servers and current default]' \ '-N-[specifies query niceness level (0-35765)]:niceness level:' \ - ':string:' + ':string:' && return 0 case "$state" in serverhost) - : ${(A)archie_servers:=${(M)$(archie -L):#archie.*}} - compadd $archie_servers + : ${(A)archie_servers:=${(M)$(_call hosts archie -L):#archie.*}} + + _wanted hosts expl 'archie servers' compadd - $archie_servers && return 0 ;; esac + +return 1 diff --git a/Completion/User/_bzip2 b/Completion/User/_bzip2 index f0fd23f90..53ec36967 100644 --- a/Completion/User/_bzip2 +++ b/Completion/User/_bzip2 @@ -1,6 +1,6 @@ #compdef bzip2 bzcat bunzip2 bzip2recover -local decompress expl state line +local decompress expl state line curcontext="$curcontext" typeset -A opt_args case "${words[1]:t}" in @@ -39,7 +39,7 @@ case "${words[1]:t}" 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' + '*:files:->files' && return 0 ;; esac @@ -49,9 +49,11 @@ if [[ "$state" = files ]]; then $+opt_args[--test] )) && unset decompress if [[ -z "$decompress" ]] ; then _description files expl 'compressed file' - _files "$expl[@]" -g '*.bz2' + _files "$expl[@]" -g '*.bz2' && return 0 else _description files expl 'file to compress' - _files "$expl[@]" -g '*~*.bz2' + _files "$expl[@]" -g '*~*.bz2' && return 0 fi fi + +return 1 diff --git a/Completion/User/_compress b/Completion/User/_compress index 288bb1645..3521dfef6 100644 --- a/Completion/User/_compress +++ b/Completion/User/_compress @@ -1,6 +1,7 @@ #compdef compress uncompress local expl state line bits common_args1 common_args2 decompress +local curcontext="$curcontext" typeset -A opt_args bits=( {9..16} ) @@ -18,18 +19,18 @@ common_args2=( \ case "${words[1]:t}" in compress) - _arguments -s \ + _arguments -C -s \ "-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[@]}" + "${common_args2[@]}" && return 0 ;; uncompress) - _arguments -s "${common_args2[@]}" + _arguments -C -s "${common_args2[@]}" && return 0 decompress=yes ;; zcat) - _arguments -s "${common_args1[@]}" + _arguments -C -s "${common_args1[@]}" && return 0 decompress=yes ;; esac @@ -37,9 +38,11 @@ esac if [[ "$state" = files ]]; then if [[ -z "$decompress" ]] || (( $+opt_args[-d] )); then _description files expl 'file to compress' - _files "$expl[@]" -g '*~*.Z' + _files "$expl[@]" -g '*~*.Z' && return 0 else _description files expl 'compressed file' - _files "$expl[@]" -g '*.Z' + _files "$expl[@]" -g '*.Z' && return 0 fi fi + +return 1 diff --git a/Completion/User/_enscript b/Completion/User/_enscript index d73a79478..21c388bb9 100644 --- a/Completion/User/_enscript +++ b/Completion/User/_enscript @@ -1,8 +1,9 @@ #compdef enscript -local state context line opt_args +local state context line curcontext="$curcontext" +typeset -A opt_args -_arguments -s \ +_arguments -C -s \ '( -2 --columns)-1' \ '(-1 --columns)-2' \ '(-1 -2 )--columns=:columns:' \ @@ -126,7 +127,7 @@ _arguments -s \ '--ul-gray=:underlay text'\''s gray level:(.8)' \ '--ul-position=:underlay text'\''s position:(+0+0 -0-0)' \ '--ul-style=:underlay text'\''s style:(outline filled)' \ - '*:filename:_files' + '*:filename:_files' && return 0 case "$state" in commandline) diff --git a/Completion/User/_finger b/Completion/User/_finger index 9b5760be7..c5787571c 100644 --- a/Completion/User/_finger +++ b/Completion/User/_finger @@ -4,7 +4,7 @@ local curcontext="$curcontext" state line typeset -A opt_args if (( ! $+_finger_args )); then - local help="$(finger -\? 2>&1)" + local help="$(_call options finger -\? 2>&1)" local -A optionmap ## `finger -\?': @@ -69,7 +69,7 @@ if (( ! $+_finger_args )); then fi fi -_arguments -C -s $_finger_args '*:finger targets:->finger-targets' +_arguments -C -s $_finger_args '*:finger targets:->finger-targets' && return 0 case "$state" in finger-targets) diff --git a/Completion/User/_gzip b/Completion/User/_gzip index e093788dc..549936a96 100644 --- a/Completion/User/_gzip +++ b/Completion/User/_gzip @@ -1,8 +1,6 @@ #compdef gzip gunzip gzcat -local decompress -local expl -local curcontext="$curcontext" state line +local decompress expl curcontext="$curcontext" state line typeset -A opt_args case "${words[1]:t}" in @@ -10,7 +8,7 @@ gunzip|zcat|gzcat) decompress=yes ;& gzip) - _arguments -s \ + _arguments -C -s \ '(--to-stdout --stdout)-c[write on standard output]' \ '(-c --stdout)--to-stdout[write on standard output]' \ '(-c --to-stdout)--stdout[write on standard output]' \ @@ -53,7 +51,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:->files' + '*:files:->files' && return 0 ;; esac diff --git a/Completion/User/_imagemagick b/Completion/User/_imagemagick index 36b95fdb3..cf6604e3d 100644 --- a/Completion/User/_imagemagick +++ b/Completion/User/_imagemagick @@ -1,6 +1,6 @@ #compdef display animate import montage convert combine mogrify xtp -local context state line expl formats +local state line expl formats curcontext="$curcontext" typeset -A opt_args # Things that could be improved: @@ -187,7 +187,7 @@ montage) ;; convert) - _arguments -M 'm:{a-z}={A-Z}' \ + _arguments -C -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-antialias[remove pixel aliasing]' \ '-append[append image sequence]' \ diff --git a/Completion/User/_look b/Completion/User/_look index 14d6285b6..74e7ab447 100644 --- a/Completion/User/_look +++ b/Completion/User/_look @@ -1,18 +1,17 @@ #compdef look -local context state line +local curcontext="$curcontext" state line typeset -A opt_args -_arguments -s \ +_arguments -C -s \ '-t+[termination character]:termination character:' \ '-f[case insensitive]' \ '-d[dictionary order]' \ - ':string:->string' + ':string:->string' && return 0 case "$state" in string) - if [[ -n "$PREFIX" ]]; then - compadd - $(_call values $words[1] $PREFIX) - fi + [[ -n "$PREFIX" ]] && + _wanted values expl value compadd - $(_call values $words[1] $PREFIX) ;; esac diff --git a/Completion/User/_lynx b/Completion/User/_lynx index 42c3498fc..2d5978d27 100644 --- a/Completion/User/_lynx +++ b/Completion/User/_lynx @@ -1,109 +1,112 @@ #compdef lynx -_lynx () { - _arguments \ - '-accept_all_cookies' \ - '-anonymous' \ - '-assume_charset=:MIMENAME:' \ - '-assume_local_charset=:MIMENAME:' \ - '-assume_unrec_charset=:MIMENAME:' \ - '-auth=:ID\:PW:' \ - '-base' \ - '-blink' \ - '-book' \ - '-buried_news' \ - '-cache=:NUMBER:' \ - '-case' \ - '-cfg=:FILENAME:_files' \ - '-child' \ - '-color' \ - '-cookies' \ - '-core' \ - '-crawl' \ - '-display=:DISPLAY:_x_display' \ - '-dump' \ - '-editor=:EDITOR:_files' \ - '-emacskeys' \ - '-enable_scrollback' \ - '-error_file=:FILENAME:_files' \ - '-fileversions' \ - '-force_html' \ - '-force_secure' \ - '-from' \ - '-ftp' \ - '-get_data' \ - '-head' \ - '-help' \ - '-historical' \ - '-homepage=:URL: _urls -f' \ - '-image_links' \ - '-ismap' \ - '-index=:URL: _urls -f' \ - '-link=:NUMBER:' \ - '-localhost' \ - '-locexec' \ - '-mime_header' \ - '-minimal' \ - '-newschunksize=:NUMBER:' \ - '-newsmaxchunk=:NUMBER:' \ - '-nobrowse' \ - '-nocc' \ - '-nocolor' \ - '-noexec' \ - '-nofilereferer' \ - '-nolist' \ - '-nolog' \ - '-nonrestarting_sigwinch' \ - '-nopause' \ - '-noprint' \ - '-noredir' \ - '-noreferer' \ - '-nosocks' \ - '-nostatus' \ - '-number_links' \ - '-partial' \ - '-pauth=:ID\:PW:' \ - '-popup' \ - '-post_data' \ - '-preparsed' \ - '-print' \ - '-pseudo_inlines' \ - '-raw' \ - '-realm' \ - '-reload' \ - '-restrictions=:options:_lynx_restrictions' \ - '-resubmit_posts' \ - '-rlogin' \ - '-selective' \ - '-show_cursor' \ - '-soft_dquotes' \ - '-source' \ - '-startfile_ok' \ - '-tagsoup' \ - '-telnet' \ - '-term=:TERM:' \ - '-tlog' \ - '-trace' \ - '-traversal' \ - '-underscore' \ - '-useragent=:NAME:' \ - '-use_mouse' \ - '-validate' \ - '-verbose' \ - '-version' \ - '-vikeys' \ - '-width=:NUMBER:' \ - ':url: _urls -f' -} +local curcontext="$curcontext" state line +typeset -A opt_args -_lynx_restrictions () { - compset -P '*,' - compadd -qS, \ +_arguments -C \ + '-accept_all_cookies' \ + '-anonymous' \ + '-assume_charset=:MIMENAME:' \ + '-assume_local_charset=:MIMENAME:' \ + '-assume_unrec_charset=:MIMENAME:' \ + '-auth=:ID\:PW:' \ + '-base' \ + '-blink' \ + '-book' \ + '-buried_news' \ + '-cache=:NUMBER:' \ + '-case' \ + '-cfg=:FILENAME:_files' \ + '-child' \ + '-color' \ + '-cookies' \ + '-core' \ + '-crawl' \ + '-display=:DISPLAY:_x_display' \ + '-dump' \ + '-editor=:EDITOR:_files' \ + '-emacskeys' \ + '-enable_scrollback' \ + '-error_file=:FILENAME:_files' \ + '-fileversions' \ + '-force_html' \ + '-force_secure' \ + '-from' \ + '-ftp' \ + '-get_data' \ + '-head' \ + '-help' \ + '-historical' \ + '-homepage=:URL:->html' \ + '-image_links' \ + '-ismap' \ + '-index=:URL:->html' \ + '-link=:NUMBER:' \ + '-localhost' \ + '-locexec' \ + '-mime_header' \ + '-minimal' \ + '-newschunksize=:NUMBER:' \ + '-newsmaxchunk=:NUMBER:' \ + '-nobrowse' \ + '-nocc' \ + '-nocolor' \ + '-noexec' \ + '-nofilereferer' \ + '-nolist' \ + '-nolog' \ + '-nonrestarting_sigwinch' \ + '-nopause' \ + '-noprint' \ + '-noredir' \ + '-noreferer' \ + '-nosocks' \ + '-nostatus' \ + '-number_links' \ + '-partial' \ + '-pauth=:ID\:PW:' \ + '-popup' \ + '-post_data' \ + '-preparsed' \ + '-print' \ + '-pseudo_inlines' \ + '-raw' \ + '-realm' \ + '-reload' \ + '-restrictions=:options:->restrictions' \ + '-resubmit_posts' \ + '-rlogin' \ + '-selective' \ + '-show_cursor' \ + '-soft_dquotes' \ + '-source' \ + '-startfile_ok' \ + '-tagsoup' \ + '-telnet' \ + '-term=:TERM:' \ + '-tlog' \ + '-trace' \ + '-traversal' \ + '-underscore' \ + '-useragent=:NAME:' \ + '-use_mouse' \ + '-validate' \ + '-verbose' \ + '-version' \ + '-vikeys' \ + '-width=:NUMBER:' \ + ':url:->html' && return 0 + +case "$state" in +restrictions) + _values -s ',' 'restriction' \ all bookmark bookmark_exec change_exec_perms default dired_support \ 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 -} - -_lynx "$@" + ;; +html) + _files -g '*.html' || _urls + ;; +esac diff --git a/Completion/User/_lzop b/Completion/User/_lzop index fb9bea153..927a34087 100644 --- a/Completion/User/_lzop +++ b/Completion/User/_lzop @@ -1,6 +1,6 @@ #compdef lzop -local expl state line decompress disp +local expl state line decompress disp curcontext="$curcontext" 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' + '*:files:->files' && return 0 case "$state" in files) diff --git a/Completion/User/_mutt b/Completion/User/_mutt index 9155df832..fefb56575 100644 --- a/Completion/User/_mutt +++ b/Completion/User/_mutt @@ -1,39 +1,38 @@ #compdef mutt -local state line muttrc="~/.muttrc" ret=1 +local curcontext="$curcontext" state line ret=1 +typeset -A opt_args - _arguments \ - '::recipient:->userhost' \ - '-a:MIME attachment:_files' \ - '-b:BCC recipient:->userhost' \ - '-c:CC recipient:->userhost' \ - '-e:post-init configuration:' \ - '-f+:mailbox:_mailboxes' \ - '-F+:init file:_files' \ - '-h+:help' \ - '-H+:draft file:_files' \ - '-i:include file:_files' \ - '-m+:default mailbox type:(mbox MMDF MH Maildir)' \ - '-n+:bypass system configuration:' \ - '-p+:resume postponed message:' \ - '-R+:open in read-only mode:' \ - '-s+:subject:' \ - '-v+:version:' \ - '-x+:emulate mailx compose:' \ - '-y+:start listing mailboxes:' \ - '-z+:start only if new messages:' \ - '-Z+:open first mailbox with new mail:' && ret=0 +_arguments -C \ + '::recipient:->userhost' \ + '-a:MIME attachment:_files' \ + '-b:BCC recipient:->userhost' \ + '-c:CC recipient:->userhost' \ + '-e:post-init configuration:' \ + '-f+:mailbox: _mailboxes' \ + '-F+:init file:_files' \ + '-h+:help:' \ + '-H+:draft file:_files' \ + '-i:include file:_files' \ + '-m+:default mailbox type:(mbox MMDF MH Maildir)' \ + '-n+:bypass system configuration:' \ + '-p+:resume postponed message:' \ + '-R+:open in read-only mode:' \ + '-s+:subject:' \ + '-v+:version:' \ + '-x+:emulate mailx compose:' \ + '-y+:start listing mailboxes:' \ + '-z+:start only if new messages:' \ + '-Z+:open first mailbox with new mail:' && ret=0 if [[ "$state" = userhost ]]; then - if compset -P '*@'; then - _description expl 'remote host name' - _hosts "$expl[@]" -q -S, - return - else - _description expl 'login name' - _users "$expl[@]" -q -S@ && ret=0 - fi - fi + if compset -P '*@'; then + _description hosts expl 'remote host name' + _hosts "$expl[@]" -q -S, && return 0 + else + _description users expl 'login name' + _users "$expl[@]" -q -S@ && return 0 + fi +fi return ret -fi diff --git a/Completion/User/_nedit b/Completion/User/_nedit index 5261a54a9..c230fbe0c 100644 --- a/Completion/User/_nedit +++ b/Completion/User/_nedit @@ -1,6 +1,7 @@ #compdef nedit nc -local state line expl nedit_common +local state line expl nedit_common curcontext="$curcontext" +typeset -A opt_args ret=1 nedit_common=( \ '-read[open file read only]' \ @@ -18,7 +19,7 @@ if [[ $words[1] = *nc ]]; then '(-noask)-ask[prompt if no server found]' \ '(-ask)-noask[start a new server without asking if none found]' \ '-svrcmd[command to run server]:server command:_command_names -e' \ - "$nedit_common[@]" + "$nedit_common[@]" && ret=0 else _x_arguments -C \ '-server[designate this session as an nedit server]' \ @@ -41,10 +42,12 @@ else '(-fg)-foreground:foreground color:_x_color' \ '(-foreground)-fg[specify foreground color]:foreground color:_x_color' \ '*-import[load additional preferences file]:nedit preferences file:_files' \ - "$nedit_common[@]" + "$nedit_common[@]" && ret=0 fi [[ $state = lang && -f ~/.nedit ]] && _wanted neditlanguages expl 'language mode' \ compadd - ${(f)"$(sed -n \ - '/^nedit.languageMode/,/^nedit/ s/.* \([^:]*\).*/\1/p' < ~/.nedit)"} + '/^nedit.languageMode/,/^nedit/ s/.* \([^:]*\).*/\1/p' < ~/.nedit)"} && ret=0 + +return ret diff --git a/Completion/User/_nslookup b/Completion/User/_nslookup index 44ab4cacc..131e5f02a 100644 --- a/Completion/User/_nslookup +++ b/Completion/User/_nslookup @@ -19,7 +19,8 @@ # other characters than lower case letters, we try to call the function # `_nslookup_host'. -local context curstate="$curcontext" expl ret=1 setopts +local state curcontext="$curcontext" expl ret=1 setopts +typeset -A opt_args setopts=( 'all[print current values]' \ diff --git a/Completion/User/_socket b/Completion/User/_socket index 788113c28..9db31c9ae 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -5,7 +5,7 @@ # hosts-ports # The style that contains pairs `host:port'. -local curcontext="$curcontext" state line expl +local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args [[ $CURRENT -eq 2 ]] && @@ -25,30 +25,32 @@ _arguments -C -s \ '-l[loop]' \ '-p[program]:command:->command' \ ':arg1:->arg1' \ - ':arg2:->arg2' + ':arg2:->arg2' && ret=0 case "$state" in command) compset -q if [[ $CURRENT -eq 1 ]]; then - _command_names -e "$@" + _command_names -e "$@" && ret=0 else - _normal + _normal && ret=0 fi ;; arg1) if (( $+opt_args[-s] )); then - _ports + _ports && ret=0 else - _wanted hosts expl 'host' _combination '' hosts-ports hosts - + _wanted hosts expl 'host' _combination '' hosts-ports hosts - && ret=0 fi ;; arg2) if (( ! $+opt_args[-s] )); then _wanted ports expl 'port to connect' \ - _combination '' hosts-ports hosts="${line[1]:q}" ports - + _combination '' hosts-ports hosts="${line[1]:q}" ports - && ret=0 fi ;; esac + +return ret diff --git a/Completion/User/_telnet b/Completion/User/_telnet index 54d9a0a2d..7b88d016a 100644 --- a/Completion/User/_telnet +++ b/Completion/User/_telnet @@ -1,21 +1,70 @@ #compdef telnet -_arguments -s \ - -{F,f,x} \ - '-8[allow 8-Bit data]' \ - '-E[disable an escape character]' \ - '-K[no automatic login]' \ - '-L[allow 8-Bit data on output]' \ - '-S+:IP type-of-service:' \ - '-X+:authentication type to disable:' \ - '-a[attempt automatic login]' \ - '-c[disable .telnetrc]' \ - '-d[debug mode]' \ - '-e+[specify escape character]:escape character:' \ - '-k+:realm:' \ - '-l+[specify user]:user:' \ - '-n+[specify tracefile]:tracefile:_files' \ - '-r[rlogin like user interface]' \ - ':host:_hosts' \ - ':port:{ _hostports $line[2] "$expl[@]" }' +# Parameter used: +# +# telnet_hosts_ports_users +# The array that contains 3-tuples `host:port:user'. +local curcontext="$curcontext" state line expl +typeset -A opt_args + +if (( ! $+_telnet_args )); then + local help="$(_call options telnet -\? < /dev/null 2>&1)" + local -A optionmap + optionmap=( + '*\[-8\]*' '-8[allow 8-Bit data]' + '*\[-E\]*' '-E[disable an escape character]' + '*\[-K\]*' '-K[no automatic login]' + '*\[-L\]*' '-L[allow 8-Bit data on output]' + '*\[-N\]*' '-N[supress reverse lookup]' + '*\[-S tos\]*' '-S+:IP type-of-service:' + '*\[-X atype\]*' '-X+:authentication type to disable:' + '*\[-a\]*' '-a[attempt automatic login]' + '*\[-c\]*' '-c[disable .telnetrc]' + '*\[-d\]*' '-d[debug mode]' + '*\[-e char\]*' '-e+[specify escape character]:escape character:' + '*\[-f/*' '-f' + '*/-F\]*' '-F' + '*\[-k realm\]*' '-k+:realm:' + '*\[-l user\]*' '-l+[specify user]:user:->users' + '*\[-n tracefile\]*' '-n+[specify tracefile]:tracefile:_files' + '*\[-r\]*' '-r[rlogin like user interface]' + '*\[-s src_addr\]*' '-s+[set source IP address]:src_addr:' + '*\[-x\]*' '-x' + '*\[-t transcom\]*' '-t+:transcom:' + '*\[-noasynch\]*' '-noasynch' + '*\[-noasyncnet\]*' '-noasyncnet' + '*\[-noasynctty\]*' '-noasynctty' + ) + _telnet_args=($optionmap[(K)"$help"]) +fi + +_arguments -C -s \ + "$_telnet_args[@]" \ + ':host:->hosts' \ + ':port:->ports' && return 0 + +case "$state" in +hosts) + _wanted hosts expl host \ + _combination -s '[@:]' '' users-hosts-ports \ + ${opt_args[-l]:+users=${opt_args[-l]:q}} \ + hosts - + ;; + +ports) + _wanted ports expl port \ + _combination -s '[@:]' '' users-hosts-ports \ + ${opt_args[-l]:+users=${opt_args[-l]:q}} \ + hosts="${line[1]:q}" \ + ports - + ;; + +users) + _wanted users expl user \ + _combination -s '[@:]' '' users-hosts-ports \ + ${line[2]:+hosts="${line[2]:q}"} \ + ${line[3]:+ports="${line[3]:q}"} \ + users - + ;; +esac diff --git a/Completion/User/_wget b/Completion/User/_wget index 0e56df355..fbacc5b27 100644 --- a/Completion/User/_wget +++ b/Completion/User/_wget @@ -1,11 +1,11 @@ #compdef wget -local state line -typeset -A options +local curcontext="$curcontext" state line +typeset -A opt_args local tmp1 tmp2 -_arguments -s \ +_arguments -C -s \ '(--version)-V[version]' '(-V)--version' \ '(--help)-h[help]' '(-h)--help' \ '(--background)-b[background]' '(-b)--background' \ @@ -68,7 +68,7 @@ _arguments -s \ '--cache=:cache:(on off)' \ '--htmlify=:htmlify:' \ '--no:no:->noflags' \ - '*:url:_urls' + '*:url:_urls' && return 0 # '--backups:backups:' \ # '-W' \ @@ -78,16 +78,13 @@ _arguments -s \ case "$state" in noflags) - tmp1=( - 'v:non verbose' - 'h:no host lookup' - 'H:no host directories' - 'd:no directories' - 'c:no clobber' - 'r:don'\''t remove listing' - 'p:no parent' - ) - tmp2=(${PREFIX}${^tmp1%%:*}) - _describe -o option tmp1 tmp2 + _values -s '' 'option' \ + 'v[non verbose]' \ + 'h[no host lookup]' \ + 'H[no host directories]' \ + 'd[no directories]' \ + 'c[no clobber]' \ + 'r[don'\''t remove listing]' \ + 'p[no parent]' ;; esac diff --git a/Completion/User/_whois b/Completion/User/_whois index 4b6d73b86..76d5a5b4a 100644 --- a/Completion/User/_whois +++ b/Completion/User/_whois @@ -118,7 +118,7 @@ _whois_single () { _arguments -C \ "$_whois_arguments[@]" \ - ':identifier:->identifier' + ':identifier:->identifier' && return 0 case "$state" in identifier) @@ -150,7 +150,7 @@ _whois_multi () { _arguments -C \ "$_whois_arguments[@]" \ - '*::identifier:->identifier' + '*::identifier:->identifier' && return 0 case "$state" in identifier) diff --git a/Completion/X/_xauth b/Completion/X/_xauth index 9461ac889..d702e5f0a 100644 --- a/Completion/X/_xauth +++ b/Completion/X/_xauth @@ -1,6 +1,6 @@ #compdef xauth -local state context line expl +local state context line expl ret=1 typeset -A opt_args local tmp cmd @@ -10,7 +10,7 @@ _arguments -s \ '(-v)-q[quiet mode]' \ '-b[break locks]' \ '-i[ignore locks]' \ - '*::command:->command' + '*::command:->command' && ret=0 while [[ -n "$state" ]]; do tmp="$state" @@ -27,7 +27,7 @@ while [[ -n "$state" ]]; do _arguments \ ':display name:->displayname' \ ':protocol name:->protocolname' \ - ':hexkey:' + ':hexkey:' && ret=0 ;; generate) @@ -42,7 +42,7 @@ while [[ -n "$state" ]]; do data) _message 'hexdata';; *) _wanted options expl 'xauth generate options' \ - compadd trusted untrusted timeout group data + compadd trusted untrusted timeout group data && ret=0 ;; esac fi @@ -50,7 +50,7 @@ while [[ -n "$state" ]]; do extract|nextract) case "$CURRENT" in - 2) _wanted files expl 'filename to write auth data' _files;; + 2) _wanted files expl 'filename to write auth data' _files && ret=0;; *) state=displayname;; esac ;; @@ -60,7 +60,7 @@ while [[ -n "$state" ]]; do ;; merge|nmerge) - _wanted files expl 'filename to read auth data' _files + _wanted files expl 'filename to read auth data' _files && ret=0 ;; remove) @@ -68,7 +68,7 @@ while [[ -n "$state" ]]; do ;; source) - _wanted files expl 'filename to source' _files + _wanted files expl 'filename to source' _files && ret=0 ;; info|exit|quit|\?) @@ -99,17 +99,19 @@ while [[ -n "$state" ]]; do 'help:print help' '?:list available commands' ) - _describe 'xauth command' tmp -- + _describe 'xauth command' tmp -- && ret=0 ;; protocolname) _wanted values expl 'authorization protocol' \ - compadd MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1 MIT-KERBEROS-5 + compadd MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1 MIT-KERBEROS-5 && ret=0 ;; displayname) - _wanted values expl 'display name' \ - compadd - ${${(f)"$(xauth list)"}%% *} || _x_display + { _wanted values expl 'display name' \ + compadd - ${${(f)"$(xauth list)"}%% *} || _x_display } && ret=0 ;; esac done + +return ret |