Merge completion with official brew completion. Add a helper to link official
completion into oh-my-zsh plugin (without overwriting). Add an alias to list
installed brews. Add brews to the path (in a somewhat strange way).
| ... | ... |
@@ -25,10 +25,12 @@ _1st_arguments=( |
| 25 | 25 |
'link:link a formula' |
| 26 | 26 |
'list:list files in a formula or not-installed formulae' |
| 27 | 27 |
'log:git commit log for a formula' |
| 28 |
+ 'missing:check all installed formuale for missing dependencies.' |
|
| 28 | 29 |
'outdated:list formulas for which a newer version is available' |
| 29 | 30 |
'prune:remove dead links' |
| 30 | 31 |
'remove:remove a formula' |
| 31 | 32 |
'search:search for a formula (/regex/ or string)' |
| 33 |
+ 'server:start a local web app that lets you browse formulae (requires Sinatra)' |
|
| 32 | 34 |
'unlink:unlink a formula' |
| 33 | 35 |
'update:freshen up links' |
| 34 | 36 |
'upgrade:upgrade outdated formulae' |
| ... | ... |
@@ -36,10 +38,14 @@ _1st_arguments=( |
| 36 | 36 |
) |
| 37 | 37 |
|
| 38 | 38 |
local expl |
| 39 |
-local -a formula installed_formulae |
|
| 39 |
+local -a formulae installed_formulae |
|
| 40 | 40 |
|
| 41 | 41 |
_arguments \ |
| 42 |
- '(-v --verbose)'{-v,--verbose}'[verbose]' \
|
|
| 42 |
+ '(-v)-v[verbose]' \ |
|
| 43 |
+ '(--cellar)--cellar[brew cellar]' \ |
|
| 44 |
+ '(--config)--config[brew configuration]' \ |
|
| 45 |
+ '(--env)--env[brew environment]' \ |
|
| 46 |
+ '(--repository)--repository[brew repository]' \ |
|
| 43 | 47 |
'(--version)--version[version information]' \ |
| 44 | 48 |
'(--prefix)--prefix[where brew lives on this system]' \ |
| 45 | 49 |
'(--cache)--cache[brew cache]' \ |
| ... | ... |
@@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then |
| 51 | 51 |
fi |
| 52 | 52 |
|
| 53 | 53 |
case "$words[1]" in |
| 54 |
- list) |
|
| 54 |
+ search|-S) |
|
| 55 |
+ _arguments \ |
|
| 56 |
+ '(--macports)--macports[search the macports repository]' \ |
|
| 57 |
+ '(--fink)--fink[search the fink repository]' ;; |
|
| 58 |
+ list|ls) |
|
| 55 | 59 |
_arguments \ |
| 56 | 60 |
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ |
| 61 |
+ '(--versions)--versions[list all installed versions of a formula]' \ |
|
| 57 | 62 |
'1: :->forms' && return 0 |
| 58 | 63 |
|
| 59 | 64 |
if [[ "$state" == forms ]]; then |
| 60 | 65 |
_brew_installed_formulae |
| 61 |
- _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae |
|
| 66 |
+ _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae |
|
| 62 | 67 |
fi ;; |
| 63 |
- install|home|log|info|uses|cat|deps) |
|
| 68 |
+ install|home|homepage|log|info|abv|uses|cat|deps|edit|options) |
|
| 64 | 69 |
_brew_all_formulae |
| 65 | 70 |
_wanted formulae expl 'all formulae' compadd -a formulae ;; |
| 66 |
- remove|edit|xo) |
|
| 71 |
+ remove|rm|uninstall|unlink|cleanup|link|ln) |
|
| 67 | 72 |
_brew_installed_formulae |
| 68 | 73 |
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; |
| 69 | 74 |
esac |
| 70 |
- |
| 71 | 75 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,13 @@ |
| 0 |
+# Move /usr/local/bin (path where brews are linked) to the front of the path |
|
| 1 |
+# This will allow us to override system binaries like ruby with our brews |
|
| 2 |
+# TODO: Do this in a more compatible way. |
|
| 3 |
+# What if someone doesn't have /usr/bin in their path? |
|
| 4 |
+export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin |
|
| 5 |
+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin |
|
| 6 |
+export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin |
|
| 7 |
+ |
|
| 8 |
+alias brews='brew list -1' |
|
| 9 |
+ |
|
| 10 |
+function brew-link-completion {
|
|
| 11 |
+ ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" |
|
| 12 |
+} |