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

local expl

: ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}

# Let the user add her own hosts in if she wants
hosts=( $hostnames $hosts )

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