Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _xutils fix for xhost
- X-seq: zsh-workers 9274
- From: Tanaka Akira <akr@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: _xutils fix for xhost
- Date: 09 Jan 2000 11:31:04 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
xhost -<TAB> didn't work for me.
Index: Completion/X/_xutils
===================================================================
RCS file: /projects/zsh/zsh/Completion/X/_xutils,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 _xutils
--- Completion/X/_xutils 1999/11/16 09:19:36 1.1.1.4
+++ Completion/X/_xutils 2000/01/09 02:17:08
@@ -46,12 +46,30 @@
'-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 +
--
Tanaka Akira
Messages sorted by:
Reverse Date,
Date,
Thread,
Author