From bf0bb55f4a41fc9aded4506ba5ccc997686e60ed Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 9 Jan 2000 02:34:28 +0000 Subject: zsh-workers/9274 --- Completion/X/_xutils | 26 ++++++++++++++++++++++---- 1 file 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 + -- cgit 1.4.1