From 2694fbd6a0dc3f44dfb689fc25f9899124436678 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 13 Jan 2018 11:03:34 +0000 Subject: [PATCH] Don't auto-tap caskroom/cask in ZSH completion The Bash completion just uses the directory tree rather than invoking `brew cask`, so doesn't exhibit the same behaviour. --- completions/zsh/_brew_cask | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/completions/zsh/_brew_cask b/completions/zsh/_brew_cask index ff277ea607..d702ea0933 100644 --- a/completions/zsh/_brew_cask +++ b/completions/zsh/_brew_cask @@ -12,17 +12,21 @@ zstyle -T ':completion:*:*:*:brew-cask:*' tag-order && \ zstyle ':completion:*:*:*:brew-cask:*' tag-order 'commands' +__brew_cask() { + [ -d "$(brew --repo caskroom/cask)" ] && brew cask $@ +} + __brew_all_casks() { local -a list local expl - list=( $(brew cask search) ) + list=( $(__brew_cask search) ) _wanted list expl 'all casks' compadd -a list } __brew_installed_casks() { local -a list local expl - list=( $(brew cask list|sed 's/(!)//') ) + list=( $(__brew_cask list|sed 's/(!)//') ) _wanted list expl 'installed casks' compadd -a list }