1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-02 17:01:19 +02:00
zsh/Completion/User/_domains
2000-05-31 09:38:25 +00:00

21 lines
583 B
Plaintext

#autoload
local expl domains tmp
if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then
if (( ! $+_cache_domains )); then
_cache_domains=()
if [[ -f /etc/resolv.conf ]]; then
while read tmp; do
[[ "$tmp" = (domain|search)* ]] &&
_cache_domains=( "$_cache_domains[@]" "${=${tmp%%[ ]#}#*[ ]}" )
done < /etc/resolv.conf
_cache_domains=( "${(@)_cache_domains:#[ ]#}" )
fi
fi
domains=( "$_cache_domains[@]" )
fi
_wanted domains expl domain \
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a domains