]> git.rmz.io Git - dotfiles.git/blob - zsh/plugins/brew/_brew
add xbindkeysrc
[dotfiles.git] / zsh / plugins / brew / _brew
1 #compdef brew
2 #autoload
3
4 # imported from the latest homebrew contributions
5
6 _brew_all_formulae() {
7 formulae=(`brew search`)
8 }
9
10 _brew_installed_formulae() {
11 installed_formulae=(`brew list`)
12 }
13
14 local -a _1st_arguments
15 _1st_arguments=(
16 'cat:display formula file for a formula'
17 'cleanup:uninstall unused and old versions of packages'
18 'create:create a new formula'
19 'deps:list dependencies and dependants of a formula'
20 'doctor:audits your installation for common issues'
21 'edit:edit a formula'
22 'home:visit the homepage of a formula or the brew project'
23 'info:information about a formula'
24 'install:install a formula'
25 'link:link a formula'
26 'list:list files in a formula or not-installed formulae'
27 'log:git commit log for a formula'
28 'missing:check all installed formuale for missing dependencies.'
29 'outdated:list formulas for which a newer version is available'
30 'prune:remove dead links'
31 'remove:remove a formula'
32 'search:search for a formula (/regex/ or string)'
33 'server:start a local web app that lets you browse formulae (requires Sinatra)'
34 'unlink:unlink a formula'
35 'update:freshen up links'
36 'upgrade:upgrade outdated formulae'
37 'uses:show formulas which depend on a formula'
38 )
39
40 local expl
41 local -a formulae installed_formulae
42
43 _arguments \
44 '(-v)-v[verbose]' \
45 '(--cellar)--cellar[brew cellar]' \
46 '(--config)--config[brew configuration]' \
47 '(--env)--env[brew environment]' \
48 '(--repository)--repository[brew repository]' \
49 '(--version)--version[version information]' \
50 '(--prefix)--prefix[where brew lives on this system]' \
51 '(--cache)--cache[brew cache]' \
52 '*:: :->subcmds' && return 0
53
54 if (( CURRENT == 1 )); then
55 _describe -t commands "brew subcommand" _1st_arguments
56 return
57 fi
58
59 case "$words[1]" in
60 search|-S)
61 _arguments \
62 '(--macports)--macports[search the macports repository]' \
63 '(--fink)--fink[search the fink repository]' ;;
64 list|ls)
65 _arguments \
66 '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
67 '(--versions)--versions[list all installed versions of a formula]' \
68 '1: :->forms' && return 0
69
70 if [[ "$state" == forms ]]; then
71 _brew_installed_formulae
72 _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
73 fi ;;
74 install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
75 _brew_all_formulae
76 _wanted formulae expl 'all formulae' compadd -a formulae ;;
77 remove|rm|uninstall|unlink|cleanup|link|ln)
78 _brew_installed_formulae
79 _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
80 esac