From a8437a62ca71422bd2355707a4429acd23b89a8a Mon Sep 17 00:00:00 2001 From: Motonori Iwata Date: Thu, 29 Sep 2011 14:35:16 +0900 Subject: [PATCH] Make zsh completion for `upgrade` smarter Closes Homebrew/homebrew#7889. Signed-off-by: Jack Nagel --- Library/Contributions/brew_zsh_completion.zsh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Library/Contributions/brew_zsh_completion.zsh b/Library/Contributions/brew_zsh_completion.zsh index 4d7d7e43ed..eb742d9243 100644 --- a/Library/Contributions/brew_zsh_completion.zsh +++ b/Library/Contributions/brew_zsh_completion.zsh @@ -14,6 +14,10 @@ _brew_installed_formulae() { installed_formulae=(`brew list`) } +_brew_outdated_formulae() { + outdated_formulae=(`brew outdated`) +} + local -a _1st_arguments _1st_arguments=( 'cat:display formula file for a formula' @@ -36,12 +40,12 @@ _1st_arguments=( 'server:start a local web app that lets you browse formulae (requires Sinatra)' 'unlink:unlink a formula' 'update:freshen up links' - 'upgrade:upgrade an installed formula' + 'upgrade:upgrade outdated formulae' 'uses:show formulas which depend on a formula' ) local expl -local -a formulae installed_formulae +local -a formulae installed_formulae outdated_formulae _arguments \ '(-v)-v[verbose]' \ @@ -77,7 +81,10 @@ case "$words[1]" in install|home|homepage|log|info|abv|uses|cat|deps|edit|options) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|rm|uninstall|unlink|cleanup|link|ln|upgrade) + remove|rm|uninstall|unlink|cleanup|link|ln) _brew_installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; + upgrade) + _brew_outdated_formulae + _wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;; esac