mirror of
https://github.com/octoleo/hosts.git
synced 2024-11-25 14:17:48 +00:00
23 lines
438 B
Bash
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
|