# dict completion by Alex Shinn _dict() { local cur DICTFILE COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} DICTFILE=/usr/share/dict/words case "$cur" in --*) COMPREPLY=( $( compgen -W '--help --version --verbose \ --host --port --database --match --strategy \ --config --nocorrect --dbs --starts --serverhelp \ --info --serverinfo --noauth --user --key --license \ --raw --pager --debug --pipesize --client' -- $cur ) ) ;; -*) COMPREPLY=( $( compgen -W '-h -p -d -m -s -c -C -D -S \ -H -i -I -a -u -k -V -L -v -r -P' $cur ) ) ;; *) COMPREPLY=( $( compgen -W '$( cat $DICTFILE )' -- $cur ) ) ;; esac return 0 } complete -F _dict dict