1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-28 15:56:33 +00:00
hosts/etc/hosts-completion.bash

23 lines
438 B
Bash
Raw Normal View History

__hosts_subcommands() {
local _commands
_commands=($(hosts commands --raw))
local _completions
_completions=(${_commands[@]})
local _current="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=()
for __command in "${_commands[@]}"
do
if [[ -n "${__command}" ]]
then
_completions+=("${__command}")
fi
done
COMPREPLY=($(compgen -W "${_completions[*]}" -- "${_current}"))
}
complete -F __hosts_subcommands hosts