diff --git a/contrib/dict b/contrib/dict new file mode 100644 index 00000000..4a0d1d52 --- /dev/null +++ b/contrib/dict @@ -0,0 +1,30 @@ +# 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