about summary refs log tree commit diff
path: root/Completion/User/_yp
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_yp')
-rw-r--r--Completion/User/_yp46
1 files changed, 19 insertions, 27 deletions
diff --git a/Completion/User/_yp b/Completion/User/_yp
index d0876f6dd..1e86bf278 100644
--- a/Completion/User/_yp
+++ b/Completion/User/_yp
@@ -1,6 +1,6 @@
 #compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname
 
-local context line state ret=1
+local curcontext="$curcontext" line state ret=1
 typeset -A opt_args
 
 if (( ! $+_yp_cache_maps )); then
@@ -16,17 +16,17 @@ fi
 
 case "$words[1]" in
 ypcat)
-  _arguments -s "$_yp_args[@]" ':map name:->map' && ret=0
+  _arguments -C -s "$_yp_args[@]" ':map name:->map' && ret=0
   ;;
 ypmatch)
-  _arguments -s "$_yp_args[@]" '*::key map:->keymap' && ret=0
+  _arguments -C -s "$_yp_args[@]" '*::key map:->keymap' && ret=0
   ;;
 yppasswd)
   _users
   return
   ;;
 ypwhich)
-  _arguments \
+  _arguments -C \
     '(-x)-d[specify domain]:domain name:' \
     '(-x -V2 -m -t)-V1[identify version 1 servers]' \
     '(-x -V1 -m -t)-V2[identify version 2 servers]' \
@@ -36,7 +36,7 @@ ypwhich)
     ':host:_hosts' && ret=0
   ;;
 ypset)
-  _arguments \
+  _arguments -C \
     '(-V2)-V1[bind version 1 servers]' \
     '(-V1)-V2[bind version 2 servers]' \
     '-d[specify domain]:domain name:' \
@@ -44,30 +44,30 @@ ypset)
     ':server:_hosts' && ret=0
     ;;
 ypserv)
-  _arguments \
+  _arguments -C \
     '-a[specify database routines]:database routines:((b\:btree d\:dbm/ndbm h\:hash))' && ret=0
   ;;
 ypbind)
-  _arguments \
+  _arguments -C \
     '-s[allow secure mode for ypbind]' \
     '-S[set domain and servers]:domain:->servers' \
     '(-ypsetme)-ypset[accept all ypset requests]' \
     '(-ypset)-ypsetme[accept only local ypset requests]' && ret=0
   ;;
 yppush)
-  _arguments \
+  _arguments -C \
     '-d[specify domain]:domain name:' \
     '-v[print messages]' \
     ':map name:->map' && ret=0
   ;;
 yppoll)
-  _arguments \
+  _arguments -C \
     '-d[specify domain]:domain name:' \
     '-h[specify host]:ask server on host:_hosts' \
     ':map name:->map' && ret=0
   ;;
 ypxfr)
-  _arguments \
+  _arguments -C \
     '-a[specify database routines]:database routines:((b\:btree d\:dbm/ndbm h\:hash))' \
     '-f[force transfer]' \
     '-c[don'"'"'t clear current map]' \
@@ -88,30 +88,22 @@ if [[ "$state" = map* ]]; then
   local expl
 
   if [[ $+opt_args[-t] -eq 0 && "$state" != maponly ]]; then
-    _tags "$context" maps nicknames
+    _tags maps nicknames
   else
-    _tags "$context" maps
+    _tags maps
   fi
 
   while _tags; do
-    if _requested maps; then
-      # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
-
-      _description expl 'map name'
-      compadd "$expl[@]" -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \
-              "$_yp_cache_maps[@]" && ret=0
-    fi
-    if _requested nicknames; then
-      _description expl 'nicknames'
-      compadd "$expl[@]" - "$_yp_cache_nicks[@]" && ret=0
-    fi
+    # 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:|=*' - \
+                "$_yp_cache_maps[@]" && ret=0
+    _requested nicknames expl nicknames &&
+        compadd "$expl[@]" - "$_yp_cache_nicks[@]" && ret=0
   done
 elif [[ "$state" = servers ]]; then
   if compset -P '*,'; then
-    if _tags "$context" hosts; then
-      _description expl 'server'
-      _hosts -qS, && ret=0
-    fi
+    _wanted hosts expl server && _hosts -qS, && ret=0
   else
     _message 'domain name'
   fi