if type complete &>/dev/null; then _yo_completion () { local words cword if type _get_comp_words_by_ref &>/dev/null; then _get_comp_words_by_ref -n = -n @ -w words -i cword else cword="$COMP_CWORD" words=("${COMP_WORDS[@]}") fi local si="$IFS" IFS=$'\n' mapfile -t COMPREPLY < <(COMP_CWORD="$cword" \ COMP_LINE="$COMP_LINE" \ COMP_POINT="$COMP_POINT" \ yo-complete completion -- "${words[@]}" \ 2>/dev/null) || return $? IFS="$si" } complete -o default -F _yo_completion yo fi