Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

bad behaviour for _ports ?



Hi all 
The actual _ports has a strange behaviour (at least it seems to me) it add to
completion only the name of the services not the ports number which make it not
very usefull.

If that's a wanted feature forget about this mail, if not, here is a version I
propose to replace it

regards,
Bapt
#autoload

local expl ports

if ! zstyle -a ":completion:${curcontext}:" ports ports; then
  (( $+_cache_ports )) ||
	: ${(A)_cache_ports:=${${${(u)${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/(tcp|udp)}%%/(tcp|udp)*}}/(#b)(*)[[:space:]]##([[:digit:]]#)/$match[2]:$match[1]}/[[:space:]]*}}
#      : ${(A)_cache_ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ 	]*}}

  ports=( "$_cache_ports[@]" )
fi

#_wanted ports expl port compadd -a "$@" - ports
_describe -t ports "ports" ports


Messages sorted by: Reverse Date, Date, Thread, Author