aboutsummaryrefslogtreecommitdiffstats
path: root/etc/bash_completion.d
diff options
context:
space:
mode:
authortim smith2016-04-05 09:48:28 -0700
committertim smith2016-04-05 09:48:28 -0700
commit3afacc351c44c4cee08c181e7c761f44e8b43722 (patch)
tree93fdc270e162b1ec9fb8eefa2f89ba81df49ff30 /etc/bash_completion.d
parentfad235d8e82ae57b2004429a0297f313aafa3186 (diff)
downloadbrew-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/brew20
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 ()