github.com/LGUG2Z/story@v0.4.1/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 15 16 unset PROG