about summary refs log tree commit diff
path: root/Completion/User/_nslookup
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_nslookup')
-rw-r--r--Completion/User/_nslookup28
1 files changed, 9 insertions, 19 deletions
diff --git a/Completion/User/_nslookup b/Completion/User/_nslookup
index f3e290505..495a0e3de 100644
--- a/Completion/User/_nslookup
+++ b/Completion/User/_nslookup
@@ -19,7 +19,7 @@
 # other characters than lower case letters, we try to call the function
 # `_nslookup_host'.
 
-local context state expl ret=1 setopts
+local context curstate="$curcontext" expl ret=1 setopts
 
 setopts=(
   'all[print current values]' \
@@ -52,17 +52,15 @@ if [[ -n "$compcontext" ]]; then
 
     funcall ret _nslookup_command && return ret
 
-    _tags any commands || return 1
-
-    _description expl 'command'
-    compadd "$expl[@]" - server lserver root finger ls view help set && ret=0
-    _hosts && ret=0
+    _alternative \
+        'commands:command:compadd server lserver root finger ls view help set' \
+	'hosts:: _host' && ret=0
     return ret
   elif [[ "$compstate[context]" = redirect ]]; then
 
     funcall ret _nslookup_redirect && return ret
 
-    _tags redirection files || return 1
+    _tags -C redirection files || return 1
 
     if [[ "$words[1]" != (finger|ls) ]]; then
       _message "redirection not allowed for command \`$words[1]'"
@@ -88,10 +86,7 @@ if [[ -n "$compcontext" ]]; then
 
   case "$words[1]" in
   (|l)server)
-    _tags argument hosts || return 1
-
-    _description expl 'new default server'
-    _hosts "$expl[@]"
+    _wanted hosts expl 'new default server' && _hosts "$expl[@]"
     return
     ;;
   root|exit|help|\?)
@@ -112,8 +107,6 @@ if [[ -n "$compcontext" ]]; then
     return
     ;;
   view)
-    _tags argument files || return 1
-
     _description expl 'view file'
     _files "$expl[@]"
     return
@@ -126,10 +119,7 @@ if [[ -n "$compcontext" ]]; then
     [[ -z "$state" ]] && return ret
     ;;
   *)
-    _tags argument hosts || return 1
-
-    _description expl 'server'
-    _hosts "$expl[@]"
+    _wanted hosts expl 'server' && _hosts "$expl[@]"
     return
   esac
 fi
@@ -140,7 +130,7 @@ if [[ -z "$state" ]]; then
   local line
   typeset -A opt_args
 
-  _arguments \
+  _arguments -C \
     "-${(@)^${(@M)setopts:#*\]:*}/\[/=[}" \
     "-${(@)^setopts:#(\(|*\]:)*}" \
     "${(@)^${(@)${(@M)setopts:#\(*}/\)/)-}/\(/(-}" \
@@ -151,7 +141,7 @@ fi
 # This is completion after `srchlist' for both types.
 
 if [[ -n "$state" ]]; then
-  _tags "$context" hosts || return 1
+  _tags hosts || return 1
 
   if compset -P '*/'; then
     _description expl 'search list entry'