summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_yp
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2018-04-07 15:12:57 +0200
committerAxel Beckert <abe@deuxchevaux.org>2018-04-07 15:12:57 +0200
commit6e1ab9aa550695ee7e3d467b4173c0b83ba7f759 (patch)
tree8fb7faa4364a7cbf1cba48296a5f537e13f2a8d9 /Completion/Unix/Command/_yp
parent5ad56a41f1ee2e61abca079f5ea8909f895ac2dd (diff)
parentf027f1d6e876708bc75d4217e1ca26898658d8d3 (diff)
downloadzsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.tar.gz
zsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.zip
Merge tag 'zsh-5.4.2-test-2' / 'upstream' branch into 'debian' branch
Test version 2 prior to zsh 5.5.
Diffstat (limited to 'Completion/Unix/Command/_yp')
-rw-r--r--Completion/Unix/Command/_yp30
1 files changed, 16 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_yp b/Completion/Unix/Command/_yp
index 104a0b4df..ed3761436 100644
--- a/Completion/Unix/Command/_yp
+++ b/Completion/Unix/Command/_yp
@@ -1,25 +1,27 @@
#compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname
-local curcontext="$curcontext" line state expl ret=1
+local curcontext="$curcontext" line state expl args ret=1
typeset -A opt_args
-if (( ! $+_yp_cache_maps )); then
- _yp_cache_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" )
- _yp_cache_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" )
- _yp_args=(
- '(-x)-d[specify domain]:domain name' \
- '(-x)-k[display keys]' \
- '(-x)-t[inhibit nicknames]' \
- '(: -d -k -t)-x[display nicknames]' \
- )
+if (( ! $+_cache_yp_maps )); then
+ typeset -ga _cache_yp_maps _cache_yp_nicks
+ _cache_yp_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" )
+ _cache_yp_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" )
fi
+args=(
+ '(-x)-d[specify domain]:domain name' \
+ '(-x)-k[display keys]' \
+ '(-x)-t[inhibit nicknames]' \
+ '(: -d -k -t)-x[display nicknames]' \
+)
+
case "$service" in
ypcat)
- _arguments -C -s "$_yp_args[@]" ':map name:->map' && ret=0
+ _arguments -C -s $args ':map name:->map' && ret=0
;;
ypmatch)
- _arguments -C -s "$_yp_args[@]" '::key map:->keymap' ':map name:->map' &&
+ _arguments -C -s $args '::key map:->keymap' ':map name:->map' &&
ret=0
;;
yppasswd)
@@ -96,9 +98,9 @@ if [[ "$state" = map* ]]; then
# The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
_requested maps expl 'map name' \
compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \
- _yp_cache_maps && ret=0
+ _cache_yp_maps && ret=0
_requested nicknames expl nicknames \
- compadd -a _yp_cache_nicks && ret=0
+ compadd -a _cache_yp_nicks && ret=0
(( ret )) || return 0
done
elif [[ "$state" = servers ]]; then