1 # brew-completion: bash completion function for Homebrew (brew command)
2 # Copyright (c)1020 Alexander Barton <alex@barton.de>
3 # This is free software and published under the terms of the GNU
4 # General Public License, see the file COPYING for details.
10 prefix=`brew --prefix`
11 formulae=`brew search`
12 COMPREPLY=( $(compgen -W '$formulae' -- "$1") )
15 _brew_formula_installed()
19 prefix=`brew --prefix`
21 COMPREPLY=( $(compgen -W '$formulae' -- "$1") )
30 prev=${COMP_WORDS[COMP_CWORD-1]}
33 declare -i i=$COMP_CWORD-1
34 while [ $i -gt 0 ]; do
35 if [[ ${COMP_WORDS[i]} != -* ]]; then
43 "cleanup"|"edit"|"home"|"log"|"prune")
47 "link"|"remove"|"uninstall"|"unlink")
48 _brew_formula_installed "$cur"
52 if [[ "$cur" == -* ]]; then
53 COMPREPLY=( $(compgen -W '--macports' \
59 if [[ "$cur" == -* ]]; then
60 COMPREPLY=( $(compgen -W '--github' \
68 if [[ "$cur" == -* ]]; then
69 COMPREPLY=( $(compgen -W '--HEAD -H \
70 --debug -d --interactive -i
71 --verbose -v --ignore-dependencies' \
79 if [[ "$cur" == -* ]]; then
80 COMPREPLY=( $(compgen -W '--brewed \
81 --unbrewed' -- "$cur") )
92 if [[ "$cur" == -* ]]; then
93 COMPREPLY=( $(compgen -W '--cache --help --prefix --version \
95 elif [ "$cmd" = "" ]; then
96 COMPREPLY=( $(compgen -W 'cleanup create edit home info \
97 install link list log prune remove search uninstall \
98 unlink update' -- "$cur") )
101 complete -F _brew brew