1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-24 21:57:35 +00:00
hosts/etc/hosts-completion.zsh

27 lines
418 B
Bash
Raw Normal View History

2020-04-13 22:01:13 +00:00
#compdef hosts
__hosts_subcommands() {
local _commands
_commands=($(hosts commands --raw))
local _completions
_completions=(${_commands[@]})
for __command in "${_commands[@]}"
do
if [[ -n "${__command}" ]]
then
_completions+=("${__command}")
fi
done
if [[ "${?}" -eq 0 ]]
then
compadd -- "${_completions[@]}"
return 0
else
return 1
fi
}
2020-04-13 22:01:13 +00:00
__hosts_subcommands "$@"