1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-10-31 18:52:31 +00:00
hosts/hosts.autocomplete.bash
2017-03-01 12:30:25 -08:00

23 lines
438 B
Bash

__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