aboutsummaryrefslogtreecommitdiffstats
path: root/share/zsh/site-functions/_brew
diff options
context:
space:
mode:
authorMike McQuaid2016-09-11 10:44:02 +0100
committerGitHub2016-09-11 10:44:02 +0100
commit287ddb64b23937646b5a24cc8124ad889ea2b388 (patch)
tree32957b290d929b959a4dd23b7cd0ff1c324386de /share/zsh/site-functions/_brew
parentad3359b96e12bca58828eb1bccb18632e79f41ea (diff)
parentbf4f33790370b7d2eb5d2b4464d6e54f686f31d0 (diff)
downloadbrew-287ddb64b23937646b5a24cc8124ad889ea2b388.tar.bz2
Merge pull request #407 from joshka/feature/zsh-completion
Call subcommands from zsh completion
Diffstat (limited to 'share/zsh/site-functions/_brew')
-rw-r--r--share/zsh/site-functions/_brew13
1 files changed, 10 insertions, 3 deletions
diff --git a/share/zsh/site-functions/_brew b/share/zsh/site-functions/_brew
index f4f5ac81c..fdb381d9e 100644
--- a/share/zsh/site-functions/_brew
+++ b/share/zsh/site-functions/_brew
@@ -2,8 +2,6 @@
#autoload
# Brew ZSH completion function
-#
-# altered from _fink
_brew_all_formulae() {
formulae=(`brew search`)
@@ -29,6 +27,12 @@ _brew_outdated_formulae() {
outdated_formulae=(`brew outdated`)
}
+__brew_command() {
+ local command="$1"
+ local completion_func="_brew_${command//-/_}"
+ declare -f "$completion_func" >/dev/null && "$completion_func" && return
+}
+
local -a _1st_arguments
_1st_arguments=(
'audit:check formulae for Homebrew coding style'
@@ -95,7 +99,8 @@ if (( CURRENT == 1 )); then
return
fi
-case "$words[1]" in
+local command="$words[1]"
+case "$command" in
analytics) compadd on off state regenerate-uuid ;;
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
_brew_all_formulae
@@ -146,4 +151,6 @@ case "$words[1]" in
_brew_outdated_formulae
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae
fi ;;
+ *)
+ __brew_command "$command" ;;
esac