From 3c05e761037189e94467cc5b967305937150c2bf Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Mon, 27 Jun 2016 15:24:31 -0500 Subject: [PATCH] Deprecating brew cask plugin I'm suggesting that this be deprecated in favor of the modified script in the zsh-completions project. See https://github.com/joshka/zsh-completions/commit/31b4e82887626eee236a9806ec9c4f5dee90056c A copy of the relevant part of the commit message of the above is included here: The original plugin suffers from the following issues (IMO): 1. it is part of oh-my-zsh which some have chosen not to use 2. it acts as a script overriding the existing brew completion rather than as a standard autoloadable file, this means it must be manually installed rather than automatically installed as part of compinit. The changes from the plugin are to fix item 2, as well as update the commands to those current in homebrew cask. This change relies on a change pending in the homebrew completion to allow it to call subcommand completions (see https://github.com/joshka/brew/commit/6b010c5700095685bad6797038e83ef558df5104) and hence should not be merged until that has been merged. Ideally, this completion would be installed as part of the homebrew cask installation, but there doesn't seem to be an easy way to do so as it is homebrew cask is installed as a homebrew tap. It also doesn't really fit in the homebrew main repo for similar reasons. --- plugins/brew-cask/brew-cask.plugin.zsh | 84 -------------------------- 1 file changed, 84 deletions(-) delete mode 100644 plugins/brew-cask/brew-cask.plugin.zsh diff --git a/plugins/brew-cask/brew-cask.plugin.zsh b/plugins/brew-cask/brew-cask.plugin.zsh deleted file mode 100644 index 91ce0f498..000000000 --- a/plugins/brew-cask/brew-cask.plugin.zsh +++ /dev/null @@ -1,84 +0,0 @@ -# Autocompletion for homebrew-cask. -# -# This script intercepts calls to the brew plugin and adds autocompletion -# for the cask subcommand. -# -# Author: https://github.com/pstadler - -compdef _brew-cask brew - -_brew-cask() -{ - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - ':subcmd:->subcmd' \ - '*::options:->options' - - case $state in - (command) - __call_original_brew - cask_commands=( - 'cask:manage casks' - ) - _describe -t commands 'brew cask command' cask_commands ;; - - (subcmd) - case "$line[1]" in - cask) - if (( CURRENT == 3 )); then - local -a subcommands - subcommands=( - "alfred:used to modify Alfred's scope to include the Caskroom" - 'audit:verifies installability of casks' - 'checklinks:checks for bad cask links' - 'cleanup:cleans up cached downloads' - 'create:creates a cask of the given name and opens it in an editor' - 'doctor:checks for configuration issues' - 'edit:edits the cask of the given name' - 'fetch:downloads Cask resources to local cache' - 'home:opens the homepage of the cask of the given name' - 'info:displays information about the cask of the given name' - 'install:installs the cask of the given name' - 'list:with no args, lists installed casks; given installed casks, lists installed files' - 'search:searches all known casks' - 'uninstall:uninstalls the cask of the given name' - "update:a synonym for 'brew update'" - ) - _describe -t commands "brew cask subcommand" subcommands - fi ;; - - *) - __call_original_brew ;; - esac ;; - - (options) - local -a casks installed_casks - local expl - case "$line[2]" in - list|uninstall) - __brew_installed_casks - _wanted installed_casks expl 'installed casks' compadd -a installed_casks ;; - audit|edit|home|info|install) - __brew_all_casks - _wanted casks expl 'all casks' compadd -a casks ;; - esac ;; - esac -} - -__brew_all_casks() { - casks=(`brew cask search`) -} - -__brew_installed_casks() { - installed_casks=(`brew cask list`) -} - -__call_original_brew() -{ - local ret=1 - _call_function ret _brew - compdef _brew-cask brew -}