]> arthur.barton.de Git - brew-completion.git/blobdiff - brew-completion.sh
Enable "brew {--cache|--cellar|--prefix}" to complete formula name
[brew-completion.git] / brew-completion.sh
index 4a55b27b6fdeea566df3b9d391289952893e511d..0934cff9aea01cb43b15c7b132de9eb10fb66b13 100644 (file)
@@ -32,7 +32,10 @@ _brew()
 
        declare -i i=$COMP_CWORD-1
        while [ $i -gt 0 ]; do
-               if [[ ${COMP_WORDS[i]} != -* ]]; then
+               if [[ ${COMP_WORDS[i]} != -* \
+                  || ${COMP_WORDS[i]} == "--cache" \
+                  || ${COMP_WORDS[i]} == "--cellar" \
+                  || ${COMP_WORDS[i]} == "--prefix" ]]; then
                        cmd=${COMP_WORDS[i]}
                        break
                fi
@@ -40,7 +43,8 @@ _brew()
        done
 
        case "$cmd" in
-               "cleanup"|"edit"|"home"|"log"|"prune")
+               "cleanup"|"edit"|"home"|"log"|"prune" \
+               |"--cache"|"--cellar"|"--prefix")
                        _brew_formula "$cur"
                        return 0
                        ;;
@@ -77,7 +81,7 @@ _brew()
                        ;;
                "list")
                        if [[ "$cur" == -* ]]; then
-                               COMPREPLY=( $(compgen -W '--brewed \
+                               COMPREPLY=( $(compgen -W '
                                        --unbrewed' -- "$cur") )
                        else
                                _brew_formula "$cur"
@@ -90,12 +94,12 @@ _brew()
        esac
 
        if [[ "$cur" == -* ]]; then
-               COMPREPLY=( $(compgen -W '--cache --help --prefix --version \
-                       -v -H' -- "$cur") )
+               COMPREPLY=( $(compgen -W '--cache --cellar --help --prefix \
+                       --version -v -H' -- "$cur") )
        elif [ "$cmd" = "" ]; then
                COMPREPLY=( $(compgen -W 'cleanup create edit home info \
-                       install link list log prune remove search uninstall \
-                       unlink update' -- "$cur") )
+                       install link list log outdated prune remove search \
+                       uninstall unlink update' -- "$cur") )
        fi
 }
 complete -F _brew brew