X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=brew-completion.sh;h=54fd003285209cfe3b7dac770aeab8a8e4676655;hb=720444bb47f05d6c6a0d232b7f3564c4b03241d4;hp=1a0946ccc4b21a9ee30da06840db4b7833eba23b;hpb=36cad6667d432f8ea8c57e29ee2539890f4c91c8;p=brew-completion.git diff --git a/brew-completion.sh b/brew-completion.sh index 1a0946c..54fd003 100644 --- a/brew-completion.sh +++ b/brew-completion.sh @@ -31,8 +31,16 @@ _brew() cmd="" # Get list of all available external commands - EXTCMD=`cd /usr/local/bin; ls -1 brew-* | cut -d'.' -f1 \ - | cut -d'-' -f2- | sed -e 's/\*//g'` + extcmdpath="`brew --prefix`/Library/Homebrew/cmd"; + if [ -d "$extcmdpath" ]; then + EXTCMD="$EXTCMD `cd "$extcmdpath"; ls -1 -- *.rb 2>/dev/null \ + | cut -d'.' -f1`" + fi + examplespath="`brew --prefix`/Library/Contributions/examples" + if [ -d "$examplespath" ]; then + EXTCMD="$EXTCMD `cd "$examplespath"; ls -1 -- brew-* 2>/dev/null \ + | cut -d'.' -f1 | cut -d'-' -f2- | sed -e 's/\*//g'`" + fi declare -i i=$COMP_CWORD-1 while [ $i -gt 0 ]; do @@ -66,7 +74,7 @@ _brew() ;; "info") if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '--github' \ + COMPREPLY=( $(compgen -W '--all --github' \ -- "$cur") ) else _brew_formula "$cur" @@ -75,9 +83,10 @@ _brew() ;; "install") if [[ "$cur" == -* ]]; then - COMPREPLY=( $(compgen -W '--HEAD -H \ - --debug -d --interactive -i - --verbose -v --ignore-dependencies' \ + COMPREPLY=( $(compgen -W '--git --HEAD -H \ + --debug -d --force -f \ + --interactive -i --verbose -v \ + --ignore-dependencies --use-llvm' \ -- "$cur") ) else _brew_formula "$cur" @@ -93,9 +102,6 @@ _brew() fi return 0 ;; - "search"|"update"|"--config") - return 0 - ;; *) for c in $EXTCMD; do if [ "$cmd" = "$c" ]; then @@ -107,12 +113,13 @@ _brew() if [[ "$cur" == -* ]]; then COMPREPLY=( $(compgen -W '--cache --cellar --config \ - --help --prefix --version -v -H' \ + --env --help --prefix --version -v -H' \ -- "$cur") ) elif [ "$cmd" = "" ]; then - COMPREPLY=( $(compgen -W 'cat cleanup create deps edit home \ - info install link list log outdated prune remove rm \ - search uninstall unlink update uses $EXTCMD' \ + COMPREPLY=( $(compgen -W 'cat cleanup create deps doctor \ + edit home info install link list log outdated prune \ + remove rm search uninstall unlink up update uses \ + $EXTCMD' \ -- "$cur") ) fi }