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

local expl

_tags any hosts || return 1

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

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