From 5e592fd9b0d0d5a0532ffa57667b3f5e7c09fa92 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 21 Oct 2014 20:53:51 +0200 Subject: 33485: fixes for zstyle context handling --- Completion/BSD/Command/_portsnap | 2 +- Completion/Darwin/Command/_defaults | 3 +- Completion/Darwin/Command/_fink | 7 +-- Completion/Debian/Command/_dchroot | 8 ++-- Completion/Debian/Command/_dchroot-dsa | 8 ++-- Completion/Debian/Command/_make-kpkg | 6 +-- Completion/Debian/Command/_update-alternatives | 2 +- Completion/Debian/Command/_vim-addons | 65 +++++++++++++------------- Completion/Unix/Command/_du | 12 ++--- Completion/Unix/Command/_ecasound | 28 +++++------ Completion/Unix/Command/_ffmpeg | 36 ++++++-------- Completion/Unix/Command/_ln | 25 ++++++---- Completion/Unix/Command/_mail | 6 +-- Completion/Unix/Command/_mosh | 3 +- Completion/Unix/Command/_mysqldiff | 3 -- Completion/Unix/Command/_od | 4 +- Completion/Unix/Command/_pgrep | 4 +- Completion/Unix/Command/_pydoc | 23 +++++---- Completion/Unix/Command/_ri | 4 +- Completion/Unix/Command/_su | 20 ++++++-- Completion/Zsh/Command/_tcpsys | 18 ++----- Completion/Zsh/Command/_zattr | 7 +-- 22 files changed, 149 insertions(+), 145 deletions(-) (limited to 'Completion') diff --git a/Completion/BSD/Command/_portsnap b/Completion/BSD/Command/_portsnap index db71fbc60..0803a842e 100644 --- a/Completion/BSD/Command/_portsnap +++ b/Completion/BSD/Command/_portsnap @@ -1,6 +1,6 @@ #compdef portsnap -local context state line +local curcontext="$curcontext" state line typeset -A opt_args flags=( diff --git a/Completion/Darwin/Command/_defaults b/Completion/Darwin/Command/_defaults index 7818e0379..ca5d87e65 100644 --- a/Completion/Darwin/Command/_defaults +++ b/Completion/Darwin/Command/_defaults @@ -25,8 +25,9 @@ _defaults(){ _1st_arguments=( read read-type write rename delete domains find help ) local curcontext="$curcontext" state line expl + typeset -A opt_args - _arguments -A '-*' \ + _arguments -C -A '-*' \ '(-currentHost)-host:host:_hosts' \ '(-host)-currentHost' \ '*::command:->subcmd' && return 0 diff --git a/Completion/Darwin/Command/_fink b/Completion/Darwin/Command/_fink index 55c9e8da5..04a067ec1 100644 --- a/Completion/Darwin/Command/_fink +++ b/Completion/Darwin/Command/_fink @@ -86,7 +86,7 @@ _fink(){ 'cleanup:removes obsolete package files' ) - local context state line expl + local curcontext="$curcontext" state line expl local -A opt_args _arguments \ @@ -136,8 +136,8 @@ _fink(){ '(-t --tab)'{-t,--tab}'[output the list with tabs as field delimiter]' \ '(-w --width)'{-w=,--width=}'[width of display]:number or "auto"' \ '(1 : -)'{-h,--help}'[display help text]' \ - '1: :->pkgs' && return 0 - + '1: :->pkgs' && return + if [[ "$state" == pkgs ]]; then _fink_get_packages _wanted packages expl 'package hint' compadd -a packages @@ -161,6 +161,7 @@ _fink(){ #scanpackages) #checksums) #cleanup) + *) _default ;; esac } diff --git a/Completion/Debian/Command/_dchroot b/Completion/Debian/Command/_dchroot index 43a797d83..c26e5691a 100644 --- a/Completion/Debian/Command/_dchroot +++ b/Completion/Debian/Command/_dchroot @@ -20,8 +20,8 @@ _arguments -S \ '*::arguments: _normal' && return 0 case "$state" in - (chroot) - _wanted tag expl 'chroot' \ - compadd ${(os:,:)${${${"$(dchroot -l )"#*: }// /}//[[\]]/,}} - ;; + chroot) + _wanted -C $context chroots expl 'chroot' \ + compadd ${(os:,:)${${${"$(_call_program chroots dchroot -l )"#*: }// /}//[[\]]/,}} + ;; esac diff --git a/Completion/Debian/Command/_dchroot-dsa b/Completion/Debian/Command/_dchroot-dsa index bed4bcf19..d4668b553 100644 --- a/Completion/Debian/Command/_dchroot-dsa +++ b/Completion/Debian/Command/_dchroot-dsa @@ -19,8 +19,8 @@ _arguments -S \ '*::arguments: _normal' && return 0 case "$state" in - (chroot) - _wanted tag expl 'chroot' \ - compadd ${(os:,:)${${${"$(dchroot -l )"#*: }// /}//[[\]]/,}} - ;; + chroot) + _wanted -C $context chroots expl 'chroot' \ + compadd ${(os:,:)${${${"$(_call_program chroots dchroot -l )"#*: }// /}//[[\]]/,}} + ;; esac diff --git a/Completion/Debian/Command/_make-kpkg b/Completion/Debian/Command/_make-kpkg index c079d9aa0..55adf882f 100644 --- a/Completion/Debian/Command/_make-kpkg +++ b/Completion/Debian/Command/_make-kpkg @@ -1,9 +1,9 @@ #compdef make-kpkg -local context state line +local curcontext="$curcontext" state line typeset -A opt_args -_arguments \ +_arguments -C \ '--help[display help message]' \ '--revision[change Debian revision number]:number:' \ '--append-to-version[specify additional kernel sub-version]:suffix:' \ @@ -45,7 +45,7 @@ _arguments \ configure\:"configure the kernel" \ debian\:"creates the debian/ directory" \ libc-kheaders\:"create the kernel headers package needed by libc" \ - ))' && return 0 + ))' && return case "$state" in (addedmodules) diff --git a/Completion/Debian/Command/_update-alternatives b/Completion/Debian/Command/_update-alternatives index ccf5084bf..31128dd82 100644 --- a/Completion/Debian/Command/_update-alternatives +++ b/Completion/Debian/Command/_update-alternatives @@ -1,6 +1,6 @@ #compdef update-alternatives -local curcontext="$curcontext" context state line alterdir +local curcontext="$curcontext" state line alterdir ret if [[ -d /var/lib/dpkg/alternatives ]]; then alterdir=/var/lib/dpkg/alternatives diff --git a/Completion/Debian/Command/_vim-addons b/Completion/Debian/Command/_vim-addons index dbd0ee31d..0ad39955d 100644 --- a/Completion/Debian/Command/_vim-addons +++ b/Completion/Debian/Command/_vim-addons @@ -1,47 +1,48 @@ #compdef vim-addons -local state line cmds ret=1 +local context state line expl ret=1 typeset -A opt_args -_arguments -C \ - {-q,--query}'[be quiet and make the output more parseable]' \ - {-r,--registry-dir}'[set the registry directory]' \ - {-s,--source-dir}'[set addon source directory]' \ - {-t,--target-dir}'[set addon target directory]' \ - {-v,--verbose}'[increase verbosity]' \ - {-y,--system-dir}'[set system-wide target directory]' \ - {-h,--help}'[help]' \ - {-w,--system-wide}'[set target directory to the system-wide one (overrides -t)]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 - +_arguments \ + '(-q --query)'{-q,--query}'[be quiet and make the output more parseable]' \ + '(-r --registry-dir)'{-r,--registry-dir}'[set the registry directory]' \ + '(-s --source-dir)'{-s,--source-dir}'[set addon source directory]' \ + '(-t --target-dir -w --system-wide)'{-t,--target-dir}'[set addon target directory]' \ + '(-v --verbose -z --silent)'{-v,--verbose}'[increase verbosity]' \ + '(y --system-dir)'{-y,--system-dir}'[set system-wide target directory]' \ + '(-)'{-h,--help}'[show help information]' \ + '(-w --system-wide -t --target-dir)'{-w,--system-wide}'[use system-wide target directory]' \ + '(-z --silent -v --verbose)'{-z,--silent}'[supress most output]' \ + '1:commands:(( + install\:install\ specified\ addons + remove\:remove\ specified\ addons + list\:list\ available\ addons\ in\ registry + status\:list\ status\ of\ addons + disable\:disable\ specified\ addons + enable\:undo\ effects\ of\ previous\ disable + files\:list\ files\ composing\ the\ specified\ addon + show\:display\ detailed\ information\ on\ specified\ addon + ))' \ + '*: :->args' && ret=0 + case $state in - cmds) - cmds=( - 'install:install the specified addon' - 'remove:remove the specified addon' - 'list:list available addons in registry' - 'status:list the status of addons' - 'disable:disable the specified addons' - 'amend:under the effects of the previous disable' - 'files:list the files composing the specified addon' - 'show:display detailed information about the specified addon' - ) - _describe -t commands 'vim-addons command' cmds && ret=0 - ;; args) case $line[1] in install) - _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 == "removed" { print $1 }') && ret=0 + _wanted -C $context addons expl 'addon' compadd - \ + ${${(M)${(f)"$(_call_program addons vim-addons -q)"}:#*removed}%$'\t'*} && ret=0 ;; - amend) - _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 == "disabled" { print $1 }') && ret=0 + enable) + _wanted -C $context addons expl 'addon' compadd - \ + ${${(M)${(f)"$(_call_program addons vim-addons -q)"}:#*disabled}%$'\t'*} && ret=0 ;; remove) - _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 ~ /disabled|installed/ { print $1 }') && ret=0 + _wanted -C $context addons expl 'addon' compadd - \ + ${${(M)${(f)"$(_call_program addons vim-addons -q)"}:#*(disabled|installed)}%$'\t'*} && ret=0 ;; - files|status|disable|show) - _wanted addon expl 'addon' compadd $(command vim-addons list) && ret=0 + *) + _wanted -C $context addons expl 'addon' compadd - \ + $(_call_program addons vim-addons list) && ret=0 ;; esac ;; diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du index 9ae6e9cb3..8b053ba4d 100644 --- a/Completion/Unix/Command/_du +++ b/Completion/Unix/Command/_du @@ -1,7 +1,7 @@ #compdef du if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then - local ret=1 + local context state line expl ret=1 _arguments -s \ '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \ @@ -24,7 +24,7 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then \*{-X+,--exclude-from=}'[exclude files matching any pattern in file]:file:_files' \ '*--exclude=[exclude files matching pattern]:pattern' \ '(-s --summarize)--max-depth=[maximum levels to recurse]:levels' \ - '--files0-from=[use NUL-terminated list of files from file]:file' \ + '--files0-from=[use NUL-terminated list of files from file]:file:_files' \ '--time-style=[show times using given style, +FORMAT for strftime formatted args]:style:->timestyle' \ '--time=-[show time of last modification of any file in the directory]:property:->time' \ '(* -)--help[display help information]' \ @@ -35,14 +35,14 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then (time) local -a property property=(atime access use ctime status) - _wanted property expl property compadd -a property && ret=0 - ;; + _wanted -C $context property expl property compadd -a property && ret=0 + ;; (timestyle) local -a style desc style=(full-iso long-iso iso +) desc=('full-iso' 'long-iso' 'iso' '+FORMAT like `date'\''') - _wanted -V style expl style compadd -d desc -a style && ret=0 - ;; + _wanted -C $context -V style expl style compadd -d desc -a style && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound index e31b072f9..7ad08d0e1 100644 --- a/Completion/Unix/Command/_ecasound +++ b/Completion/Unix/Command/_ecasound @@ -1,9 +1,9 @@ #compdef ecasound -local curcontext="$curcontext" state line expl +local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args -_arguments \ +_arguments -C \ '-c[start in interactive mode]' \ '(-q)-d\:-[debug level]:debug level' \ '-D[print all debug information to stderr]' \ @@ -53,7 +53,7 @@ _arguments \ '*-eli\:-[LADSPA Plugin]: :->el' \ '*-gc\:-[time crop gate]: :->gc' \ '*-ge\:-[threshold gate]: :->ge' \ - && return 0 + ':input source:->io' && ret=0 case $state in filters) @@ -82,12 +82,12 @@ case $state in 'r[reverb effect]: :->etr' ;; emod) - _values -S : 'envelopme modulation' \ + _values -S : 'envelope modulation' \ 'b[pulse gate]: :->eemb' \ 'p[pulse gate (hz)]: :->eemp' \ 't[tremolo effect]: :->eemt' ;; -esac +esac && ret=0 case $state in b) @@ -173,12 +173,12 @@ case $state in typeset -A msgs local str msgs=( - eac 'amplification value (percent):channel' - eaw 'amplification value (percent):channel:max-clipped-samples' - ec 'compression rate (decibels):threshold (0.0-1.0)' - eca 'peak-level:release-time (seconds):fast compression rate (0.0-1.0):compression rate' - enm 'threshold-level:pre-hold-time (msec):attack-time (msec):post-hold-time (msec):release-time (msec)' - ezx 'left DC fix value:right CD fix value' + eac 'amplification value (percent):channel' + eaw 'amplification value (percent):channel:max-clipped-samples' + ec 'compression rate (decibels):threshold (0.0-1.0)' + eca 'peak-level:release-time (seconds):fast compression rate (0.0-1.0):compression rate' + enm 'threshold-level:pre-hold-time (msec):attack-time (msec):post-hold-time (msec):release-time (msec)' + ezx 'left DC fix value:right CD fix value' eemb 'pulse frequency (beats per minute):on time (msec)' eemp 'pulse frequency (hz):on time (percent)' eemt 'tremolo speed (beats per second):depth (percent)' @@ -206,5 +206,7 @@ case $state in str="${str#*:}" done _message "${str%%:*}" - ;; -esac + ;; +esac && ret=0 + +return ret diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index 6a4ba234d..d68a094d4 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -1,6 +1,6 @@ #compdef ffmpeg -local context state line expl +local curcontext="$curcontext" state line expl typeset -A opt_args (( $+functions[_ffmpeg_presets] )) || _ffmpeg_presets() { @@ -33,14 +33,10 @@ typeset -A opt_args _wanted ffmpeg-formats expl 'force format' compadd -a formats } -(( $+functions[_ffmpeg_list_pix_fmts] )) || _ffmpeg_list_pix_fmts() { - echo - ${${${(M)${(f)"$(_call_program formats $words[1] -pix_fmts 2>/dev/null)"}:#[I.][O.][H.][P.][B.] [^=[:space:]]*}#* }%% *} -} - (( $+functions[_ffmpeg_pix_fmts] )) || _ffmpeg_pix_fmts() { local pix_fmts - pix_fmts=($(_ffmpeg_list_pix_fmts)) - _wanted ffmpeg-pix-fmts expl 'set pixel format' compadd -a pix_fmts + _wanted ffmpeg-pix-fmts expl 'pixel format' compadd "$@" - \ + ${${${(M)${(f)"$(_call_program formats $words[1] -pix_fmts 2>/dev/null)"}:#[I.][O.][H.][P.][B.] [^=[:space:]]*}#* }%% *} } (( $+functions[_ffmpeg_bsfs] )) || _ffmpeg_bsfs() { @@ -71,10 +67,10 @@ typeset -A _ffmpeg_flags local match mbegin mend integer ret=1 - if [[ $PREFIX = (#b)(*)[-+]([^-+]#) ]]; then + if [[ $PREFIX = (#b)(*)[-+]([^-+]#) ]]; then if [[ -n ${flag_options[(R)$match[2]]} ]]; then _ffmpeg_new_flag_options && ret=0 - fi + fi if [[ -n ${flag_options[(R)$match[2]?*]} ]]; then _ffmpeg_more_flag_options ${#match[1]} && ret=0 fi @@ -82,7 +78,7 @@ typeset -A _ffmpeg_flags _ffmpeg_flag_options && ret=0 fi - return $ret + return ret } (( $+functions[_ffmpeg_register_lastopt_values] )) || _ffmpeg_register_lastopt_values() { @@ -150,7 +146,7 @@ local -a _ffmpeg_argspecs elif [[ $lastopt == -pix_fmt ]]; then lastopt_takesargs=0 lastopt="*$lastopt" - lastopt+=": :_ffmpeg_pix_fmts" + lastopt+=":set pixel format:_ffmpeg_pix_fmts" elif [[ $example == bitstream_filter ]]; then lastopt_takesargs=0 lastopt+=": :_ffmpeg_bsfs" @@ -175,17 +171,17 @@ local -a _ffmpeg_argspecs [[ -n $lastopt ]] && _ffmpeg_register_lastopt_values } -_arguments -S \ +_arguments -C -S \ "${_ffmpeg_argspecs[@]}" \ '*:output file:_files' \ - && return 0 + && return [[ "$state" == "vfilters" ]] && _values -s , -S = 'video filters' \ 'aspect:set aspect ratio (rational number X\:Y or decimal number):' \ 'crop:crop input video (x\:y\:width\:height):' \ - 'format: :->format' \ - 'noformat: :->noformat' \ + 'format: :_sequence -s : _ffmpeg_pix_fmts' \ + 'noformat: :_sequence -s : _ffmpeg_pix_fmts' \ 'null' \ 'pad:add pads to the input image (width\:height\:x\:y\:color_string):' \ 'pixelaspect:set pixel aspect ratio (rational number X\:Y or decimal number):' \ @@ -196,15 +192,9 @@ _arguments -S \ 'buffer' \ 'nullsrc' \ 'nullsink' \ - && return 0 - -[[ "$state" == "format" ]] && - _values -s : -S = 'convert input video to one of the specified pixel formats' $(_ffmpeg_list_pix_fmts) && return 0 - -[[ "$state" == "noformat" ]] && - _values -s : -S = 'disable specified pixel formats by force' $(_ffmpeg_list_pix_fmts) && return 0 + && return [[ -n $state && -n $_ffmpeg_flags[$state] ]] && - _ffmpeg_flags $state && return 0 + _ffmpeg_flags $state && return return 1 diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index 89b7177ab..12baf76a9 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -3,10 +3,17 @@ local curcontext="$curcontext" state line ret=1 local -A opt_args -local -a args +local -a args bsd args=( '-f[remove existing destination files]' - '-s[create symbolic links instead of hard links]') + '-s[create symbolic links instead of hard links]' +) +bsd=( + '-F[remove existing destination directories]' + {-h,-n}'[do not dereference destination]' + '-i[prompt before removing destination files]' + '-v[print name of each linked file]' +) local -a opts @@ -44,14 +51,16 @@ elif (( ${+builtins[ln]} )); then {-h,-n}'[do not dereference destination]' '-i[prompt before removing destination files]') elif [[ $OSTYPE == darwin* ]]; then - args+=( - '-F[remove existing destination directories]' - {-h,-n}'[do not dereference destination]' - '-i[prompt before removing destination files]' - '-v[print name of each linked file]') + args+=( $bsd ) +elif [[ $OSTYPE == freebsd* ]]; then + args+=( $bsd + '(-L)-P[create hard links directly to symbolic links]' + '(-P)-L[create hard links to symbolic link references]' + "-w[warn if source of a symbolic link doesn't currently exist]" + ) fi -_arguments -s $opts \ +_arguments -C -s $opts \ $args \ ':link target:_files' \ '*:: :->files' && ret=0 diff --git a/Completion/Unix/Command/_mail b/Completion/Unix/Command/_mail index 90c75359d..d618cf366 100644 --- a/Completion/Unix/Command/_mail +++ b/Completion/Unix/Command/_mail @@ -1,9 +1,9 @@ #compdef mail mailx=mail Mail=mail mush zmail nail=mail _arguments -s \ - '(-f -u)*-b[specify a BCC recipient]:BCC recipient:->userhost' \ - '(-f -u)*-c[specify a CC recipient]:CC recipient:->userhost' \ + '(-f -u)*-b[specify a BCC recipient]:BCC recipient:_email_addresses -n $service' \ + '(-f -u)*-c[specify a CC recipient]:CC recipient:_email_addresses -n $service' \ '(-b -c -u -s *)-f+[specify mail folder]:mailbox:_mailboxes' \ - '(-f -u)-s+[specify a subject]:subject:' \ + '(-f -u)-s+[specify a subject]:subject' \ "(-b -c -f -s *)-u+[read specified user's mail]:user:_users" \ "(-f -u)*:recipient:_email_addresses -n $service" diff --git a/Completion/Unix/Command/_mosh b/Completion/Unix/Command/_mosh index dacbd1018..c19f6ebde 100644 --- a/Completion/Unix/Command/_mosh +++ b/Completion/Unix/Command/_mosh @@ -1,9 +1,8 @@ #compdef mosh local curcontext="$curcontext" state line -local -a suf -_arguments \ +_arguments -C \ '(-)--help[display help information]' \ '(-)--version[display version information]' \ "--no-init[don't set terminal init string]" \ diff --git a/Completion/Unix/Command/_mysqldiff b/Completion/Unix/Command/_mysqldiff index 094694d32..4b46c86df 100644 --- a/Completion/Unix/Command/_mysqldiff +++ b/Completion/Unix/Command/_mysqldiff @@ -1,8 +1,5 @@ #compdef mysqldiff -local curcontext="$curcontext" state line expl -typeset -A opt_args - _mysqldiff () { _arguments -s \ {-h{,1,2},--host{,1,2}=}':server hostname:_mysql_hosts' \ diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od index d542597e0..36a9b7dae 100644 --- a/Completion/Unix/Command/_od +++ b/Completion/Unix/Command/_od @@ -1,6 +1,6 @@ #compdef od -local context state state_descr line args ret=1 +local curcontext="$curcontext" state state_descr line args ret=1 local -A opt_args args=( @@ -49,7 +49,7 @@ else esac fi -_arguments -s -S : "$args[@]" && return 0 +_arguments -C -s -S : "$args[@]" && return 0 case "$state" in (format) diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 95d0ea284..3af55a379 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -1,6 +1,6 @@ #compdef pgrep pkill -local context state line ret=1 expl +local curcontext="$curcontext" state line ret=1 expl typeset -A opt_args typeset -a arguments @@ -66,7 +66,7 @@ esac arguments=( ${(M)arguments:#(|\*)(|\(*\))-[$optchars]*} '*:process name:->pname') -_arguments -s -w $arguments && ret=0 +_arguments -C -s -w $arguments && ret=0 case $state in (tty) diff --git a/Completion/Unix/Command/_pydoc b/Completion/Unix/Command/_pydoc index 92a01a76f..f85ab0c2d 100644 --- a/Completion/Unix/Command/_pydoc +++ b/Completion/Unix/Command/_pydoc @@ -1,16 +1,19 @@ #compdef pydoc -local context state line +local context state line ret=1 typeset -A opt_args _arguments \ - '-k[keyword]:keyword:' \ - '-p[port]:port:_ports' \ - '-g[gui]' \ - '-w[write out HTML]:file or dir:_files' \ - ':keyword, topic, module, package, or dotted reference:->lookup' && return 0 + '(-)-k[search keyword]:keyword' \ + '(- *)-p[start web server on specified port]:port number' \ + '(- *)-g[start gui]' \ + '(-)-w[write out HTML]:file or dir:_files' \ + '(- *)-h[show help information]' \ + '*: :->lookup' && ret=0 -_alternative \ - 'keywords:keyword:compadd ${=${${(f)"$(pydoc keywords)"}[2,-1]}}' \ - 'topics:topic:compadd ${=${${(f)"$(pydoc topics)"}[2,-1]}}' \ - 'modules:module:' +[[ -n $state ]] && _alternative -C $context \ + 'keywords:keyword:compadd ${=${${(f)"$(_call_program keywords pydoc keywords)"}[2,-1]}}' \ + 'topics:topic:compadd ${=${${(f)"$(_call_program topics pydoc topics)"}[2,-1]}}' \ + 'modules:module:' && ret=0 + +return ret diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri index feb10ec91..070f46ac2 100644 --- a/Completion/Unix/Command/_ri +++ b/Completion/Unix/Command/_ri @@ -3,7 +3,7 @@ local curcontext="$curcontext" state line ret=1 typeset -A opt_args -_arguments \ +_arguments -C \ '(- *)'{-h,--help}'[print help information and exit]' \ '(- *)'{-v,--version}'[display the version of ri]' \ '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \ @@ -42,8 +42,6 @@ if [[ "$state" = ri-name ]]; then if compset -P '?*(::|\#|.)'; then class_dir=${IPREFIX//(::|\#|.)/\/} - #else - # : fi esc_name=${${(Q)PREFIX}//(#b)([^A-Za-z0-9_])/$(printf %%%x ${(qq)match[1]})} diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index 6d0f2cd9f..9d3f28066 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -1,9 +1,9 @@ #compdef su local -A opt_args -local -a args state context +local -a args context state line expl local shell=${words[(i)(-s|--shell=*)]} first='1:user name:_users' -local usr=root line +local usr=root if _pick_variant gnu="Free Software Foundation" unix --version; then args=( @@ -20,10 +20,20 @@ if _pick_variant gnu="Free Software Foundation" unix --version; then ) else args=( - '-c[pass command to shell]:command string:->command' '-l[use a login shell]' '-s[run the specified shell]:shell:->shell' ) + case $OSTYPE in + freebsd*) + args=( + '-c[use settings from specified login class]:class' + '-f[if the invoked shell is csh, prevent it from reading .cshrc]' + '-l[use a login shell]' + '-m[do not reset environment]' + '-s[set the MAC label]' + ) + *) args+=( '-c[pass command to shell]:command string:->command' ) ;; + esac fi if [[ $#words -ge 2 && $words[2] != -* && CURRENT -ne 2 ]]; then @@ -50,11 +60,11 @@ case $state in return ;; (shell) - compadd ${(f)^"$(fd' - '(-a -s -l)-f[open session for accept on fd]:fd:->fd' + '(-f -s -l)-a[open session for accept on fd]:fd' + '(-a -s -l)-f[open session for accept on fd]:fd' '-q[quiet mode]' '-z[no zle handler]' ) @@ -19,7 +19,7 @@ case $service in elif [[ -n $words[(R)-(l|s)*] ]]; then argargs+=('*:session:->session') else - argargs+=(':host:->host' ':port:->port' '*:session:->session') + argargs+=(':host:_hosts' ':port:_ports' '*:session:->session') fi _arguments -C $argargs ;; @@ -27,14 +27,6 @@ esac while (( $#state )); do case "$state[1]" in - (host) - _hosts - ;; - - (port) - _ports - ;; - (sessionlist) compset -P '*,' ;& diff --git a/Completion/Zsh/Command/_zattr b/Completion/Zsh/Command/_zattr index 1924bb28d..73564172b 100644 --- a/Completion/Zsh/Command/_zattr +++ b/Completion/Zsh/Command/_zattr @@ -1,7 +1,6 @@ #compdef zgetattr zsetattr zdelattr zlistattr -local state line expl ret=1 REPLY -local -a args privs +local context state line expl ret=1 REPLY case $service in zgetattr) @@ -30,5 +29,7 @@ esac && ret=0 if [[ $state = attrs ]]; then zlistattr ${~${(Q)line[1]}} REPLY 2> /dev/null - _wanted attrs expl 'attribute' compadd $REPLY + _wanted -C "$context[1]" attrs expl 'attribute' compadd -a REPLY && ret=0 fi + +return ret -- cgit 1.4.1