Clean up zsh completion

1. Fix a misspelled variable to avoid shell namespace pollution
2. Remove a bogus completion (the 'brew xo' one)
3. Add missing tab completion code for
   - Several arguments/commands (options, --cellar etc.)
   - Aliases (e.g. home and homepage)
   - 'brew edit' complete to all formulae, not just installed ones

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
George Kulakowski 2011-02-08 21:04:54 -05:00 committed by Adam Vandenberg
parent 2b88c24ead
commit 2fb68be78d

View File

@ -40,10 +40,14 @@ _1st_arguments=(
) )
local expl local expl
local -a formula installed_formulae local -a formulae installed_formulae
_arguments \ _arguments \
'(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
'(--config)--config[brew configuration]' \
'(--env)--env[brew environment]' \
'(--repository)--repository[brew repository]' \
'(--version)--version[version information]' \ '(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \ '(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \ '(--cache)--cache[brew cache]' \
@ -55,7 +59,11 @@ if (( CURRENT == 1 )); then
fi fi
case "$words[1]" in case "$words[1]" in
list) search|-S)
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
list|ls)
_arguments \ _arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
'(--versions)--versions[list all installed versions of a formula]' \ '(--versions)--versions[list all installed versions of a formula]' \
@ -65,10 +73,10 @@ case "$words[1]" in
_brew_installed_formulae _brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;; fi ;;
install|home|log|info|uses|cat|deps) install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
_brew_all_formulae _brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;; _wanted formulae expl 'all formulae' compadd -a formulae ;;
remove|edit|xo) remove|rm|uninstall|unlink|cleanup|link|ln)
_brew_installed_formulae _brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
esac esac