Permalink
Browse files

Cache homebrew formuae

  • Loading branch information...
1 parent b74199e commit 293d5a643c496a6f1028007b2bd0fabc4a5170f5 @joshuaclayton committed Aug 5, 2012
Showing with 13 additions and 3 deletions.
  1. +2 −0 bin/cache_brew_search_results
  2. +0 −1 vim/bundle/vim-ruby-complexity
  3. +10 −2 zsh_profile.d/completion.zsh
  4. +1 −0 zshrc
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+brew search | sed "s/ /\n/" > $HOMEBREW_SEARCH_CACHE_PATH
Submodule vim-ruby-complexity deleted from 953d58
@@ -70,6 +70,14 @@ _gem() {
}
compdef _gem gem
+function __filter_homebrew {
+ if [[ $1 == "" ]]; then
+ cat $HOMEBREW_SEARCH_CACHE_PATH
+ else;
+ cat $HOMEBREW_SEARCH_CACHE_PATH | grep $1
+ fi
+}
+
_brew() {
if (( CURRENT == 2 )); then
compadd list
@@ -82,12 +90,12 @@ _brew() {
elif (( CURRENT >= 3 )); then
if (( CURRENT == 3 )); then
if [[ $words[2] == "options" || $words[2] == "info" || $words[2] == "edit" || $words[2] == "options" || $words[2] == "deps" || $words[2] == "uses" || $words[2] == "home" ]]; then
- compadd $(brew search ${words[3]})
+ compadd $(__filter_homebrew ${words[3]})
fi
fi
if [[ $words[2] == "install" ]]; then
- compadd $(brew search ${words[-1]})
+ compadd $(__filter_homebrew ${words[-1]})
elif [[ $words[2] == "uninstall" ]]; then
compadd $(brew list)
elif [[ $words[2] == "cleanup" ]]; then
View
1 zshrc
@@ -1,5 +1,6 @@
export REMOTE_GEM_CACHE_PATH=$HOME/.remote-gem-cache
export ZSH_HISTORY_PATH=$HOME/.zsh_history
+export HOMEBREW_SEARCH_CACHE_PATH=$HOME/.homebrew-search-cache
source $HOME/.aliasrc

0 comments on commit 293d5a6

Please sign in to comment.