about summary refs log tree commit diff
path: root/Completion/User/_hosts
blob: 196f40c8374d23e7d22055e6bbed9cca87eaf7a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#compdef ftp ncftp ping rwho rup xping traceroute host

local expl hosts

if ! _style -a hosts hosts hosts; then
  (( $+_cache_hosts )) ||
      : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}

  hosts=( "$_cache_hosts[@]" )
fi

_wanted hosts expl host &&
    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$hosts[@]"