_example()
{
local cur prev
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ ${prev} == example ]] ; then
COMPREPLY=( $(compgen -W "git" -- ${cur}) )
elif [[ ${prev} == git ]] ; then
_command
elif [[ ${prev} == g ]] ; then
# ??? TODO
# I want the same completion for `example git <TAB>` and `example g <TAB>`
else
COMPREPLY=()
fi
return 0
}
complete -F _example example
I know how to "call" bash-completion for next command. (code above)
eg.: example git <TAB> => completion for git
How to make bash-completion that "calls" any completion I want for next command?
eg.: example g <TAB> => completion for git