github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/cli/autocomplete/bash_autocomplete (about) 1 #! /bin/bash 2 3 : ${PROG:=$(basename ${BASH_SOURCE})} 4 5 _cli_bash_autocomplete() { 6 local cur opts base 7 COMPREPLY=() 8 cur="${COMP_WORDS[COMP_CWORD]}" 9 opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) 10 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 11 return 0 12 } 13 14 complete -F _cli_bash_autocomplete $PROG