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

local expl

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

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