aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua McKinney2016-08-19 12:06:59 -0500
committerJoshua McKinney2016-09-11 14:08:50 -0500
commitabae36d96dd8cd7c6abf6650204ccf4791948dd9 (patch)
treecdd1b56f9f6f4ca0f6a4f1984898fa7c5cb41ff1
parent4ff6ea950bf97251e71e0ffda089c2edcfd780dc (diff)
downloadbrew-abae36d96dd8cd7c6abf6650204ccf4791948dd9.tar.bz2
Refactor brew-cask zsh completion to functions
-rw-r--r--share/zsh/site-functions/_brew_cask18
1 files changed, 10 insertions, 8 deletions
diff --git a/share/zsh/site-functions/_brew_cask b/share/zsh/site-functions/_brew_cask
index 59fe17950..d31d71792 100644
--- a/share/zsh/site-functions/_brew_cask
+++ b/share/zsh/site-functions/_brew_cask
@@ -30,11 +30,17 @@
# SOFTWARE.
__brew_all_casks() {
- brew cask search
+ local -a list
+ local expl
+ list=( $(brew cask search) )
+ _wanted list expl 'all casks' compadd -a list
}
__brew_installed_casks() {
- brew cask list|sed 's/(!)//'
+ local -a list
+ local expl
+ list=( $(brew cask list|sed 's/(!)//') )
+ _wanted list expl 'installed casks' compadd -a list
}
_brew_cask()
@@ -69,15 +75,11 @@ _brew_cask()
)
_describe -t commands "brew cask subcommand" subcommands ;;
(options)
- local -a casks installed_casks
- local expl
case "$line[1]" in
list|uninstall)
- installed_casks=($(__brew_installed_casks))
- _wanted installed_casks expl 'installed casks' compadd -a installed_casks ;;
+ __brew_installed_casks ;;
audit|cat|edit|fetch|home|info|install|zap)
- casks=($(__brew_all_casks))
- _wanted casks expl 'all casks' compadd -a casks ;;
+ __brew_all_casks ;;
esac ;;
esac
}