diff options
| author | tim smith | 2016-04-05 09:48:28 -0700 |
|---|---|---|
| committer | tim smith | 2016-04-05 09:48:28 -0700 |
| commit | 3afacc351c44c4cee08c181e7c761f44e8b43722 (patch) | |
| tree | 93fdc270e162b1ec9fb8eefa2f89ba81df49ff30 /etc/bash_completion.d | |
| parent | fad235d8e82ae57b2004429a0297f313aafa3186 (diff) | |
| download | brew-3afacc351c44c4cee08c181e7c761f44e8b43722.tar.bz2 | |
Speed up tab completion
Fixes #20. Closes #23.
Diffstat (limited to 'etc/bash_completion.d')
| -rw-r--r-- | etc/bash_completion.d/brew | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/etc/bash_completion.d/brew b/etc/bash_completion.d/brew index 0a709d7f2..6e3cc76c3 100644 --- a/etc/bash_completion.d/brew +++ b/etc/bash_completion.d/brew @@ -45,23 +45,9 @@ __brewcomp () __brew_complete_formulae () { local cur="${COMP_WORDS[COMP_CWORD]}" - local lib=$(brew --repository)/Library - local taps=${lib}/Taps - local ff=$(\ls ${lib}/Formula 2>/dev/null | sed 's/\.rb//g') - local af=$(\ls ${lib}/Aliases 2>/dev/null) - local tf file - - for file in ${taps}/*/*/*.rb ${taps}/*/*/Formula/*.rb ${taps}/*/*/HomebrewFormula/*.rb; do - [ -f "$file" ] || continue - file=${file/"Formula/"/} - file=${file/"HomebrewFormula/"/} - file=${file#${lib}/Taps/} - file=${file%.rb} - file=${file/homebrew-/} - tf="${tf} ${file}" - done - - COMPREPLY=($(compgen -W "$ff $af $tf" -- "$cur")) + local formulas="$(brew search)" + local shortnames="$(echo "$formulas" | grep / | cut -d / -f 3)" + COMPREPLY=($(compgen -W "$formulas $shortnames" -- "$cur")) } __brew_complete_installed () |
