Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cache homebrew formuae

  • Loading branch information...
commit 293d5a643c496a6f1028007b2bd0fabc4a5170f5 1 parent b74199e
@joshuaclayton authored
View
2  bin/cache_brew_search_results
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+brew search | sed "s/ /\n/" > $HOMEBREW_SEARCH_CACHE_PATH
1  vim/bundle/vim-ruby-complexity
@@ -1 +0,0 @@
-Subproject commit 953d58e6b71141795e741eb109a47ed3f7986b67
View
12 zsh_profile.d/completion.zsh
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.