diff options
Diffstat (limited to 'completions/dict')
-rw-r--r-- | completions/dict | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/completions/dict b/completions/dict index c3ea9906..f3426ffd 100644 --- a/completions/dict +++ b/completions/dict @@ -13,35 +13,35 @@ _dict() local host port db i - for (( i=1; i < cword; i++ )); do + for ((i = 1; i < cword; i++)); do case ${words[i]} in - --host|-!(-*)h) + --host | -!(-*)h) host=${words[++i]} [[ -n $host ]] && host="-h $host" ;; - --port|-!(-*)p) + --port | -!(-*)p) port=${words[++i]} [[ -n $port ]] && port="-p $port" ;; - --database|-!(-*)d) + --database | -!(-*)d) db=${words[++i]} [[ -n $db ]] && host="-d $db" ;; esac done - if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi case $prev in - --database|-info|-!(-*)[di]) - COMPREPLY=( $(compgen -W '$(_dictdata -D)' -- "$cur") ) + --database | -info | -!(-*)[di]) + COMPREPLY=($(compgen -W '$(_dictdata -D)' -- "$cur")) return ;; - --strategy|-!(-*)s) - COMPREPLY=( $(compgen -W '$(_dictdata -S)' -- "$cur") ) + --strategy | -!(-*)s) + COMPREPLY=($(compgen -W '$(_dictdata -S)' -- "$cur")) return ;; esac @@ -52,13 +52,13 @@ _dict() # it down with grep if $cur looks like something that's safe to embed # in a pattern instead. if [[ $cur == +([-A-Za-z0-9/.]) ]]; then - COMPREPLY=( $(compgen -W \ - '$(command grep "^${cur//./\\.}" $dictfile)' -- "$cur") ) + COMPREPLY=($(compgen -W \ + '$(command grep "^${cur//./\\.}" $dictfile)' -- "$cur")) else - COMPREPLY=( $(compgen -W '$(cat $dictfile)' -- "$cur") ) + COMPREPLY=($(compgen -W '$(cat $dictfile)' -- "$cur")) fi fi } && -complete -F _dict -o default dict rdict + complete -F _dict -o default dict rdict # ex: filetype=sh |