about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-09 02:34:28 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-09 02:34:28 +0000
commitbf0bb55f4a41fc9aded4506ba5ccc997686e60ed (patch)
tree44b6894733b5d577c491a4e2c86dd785fc90e92f
parent56d0011bb13e7390b32a3751b98edf7909132c7a (diff)
downloadzsh-bf0bb55f4a41fc9aded4506ba5ccc997686e60ed.tar.gz
zsh-bf0bb55f4a41fc9aded4506ba5ccc997686e60ed.tar.xz
zsh-bf0bb55f4a41fc9aded4506ba5ccc997686e60ed.zip
zsh-workers/9274
-rw-r--r--Completion/X/_xutils26
1 files changed, 22 insertions, 4 deletions
diff --git a/Completion/X/_xutils b/Completion/X/_xutils
index 505701676..216203622 100644
--- a/Completion/X/_xutils
+++ b/Completion/X/_xutils
@@ -46,12 +46,30 @@ xev)
     '-rv'
   ;;
 xhost)
-  local expl type ret=1
+  local expl type ret=1 tmp
 
   if compset -P '-'; then
-    _wanted displays expl 'disallow access' &&
-        compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \
-                "${${(@M)${(@f)$(xhost)}[2,-1]:#LOCAL:*}#INET:}"
+    tmp=(${(f)"$(xhost)"})
+    shift tmp
+    tmp=(${tmp:#LOCAL:|<*>})
+    if [[ "$tmp" = *:* ]]; then
+      if compset -P '(#b)(*):'; then
+	type="$match[1]"
+	_wanted displays expl 'disallow access' &&
+	    {
+	      compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \
+		      ${${(M)tmp:#(#i)$type:*}#(#i)$type:} ||
+	      _hosts "$expl[@]"
+	    }
+      else
+	_alternative \
+	    'types:name family:compadd -S: ${(L)tmp%%:*}' \
+	    'hosts:host:compadd ${(@)tmp#*:}' && ret=0
+      fi
+    else
+      _wanted displays expl 'disallow access' &&
+	  { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - $tmp || _hosts "$expl[@]" }
+    fi
   else
     compset -P +