84 lines
3.1 KiB
Plaintext
84 lines
3.1 KiB
Plaintext
![]() |
#compdef brew-cask
|
||
|
#autoload
|
||
|
|
||
|
# Autocompletion for homebrew-cask (https://github.com/caskroom/homebrew-cask/).
|
||
|
#
|
||
|
# Originally sourced from the oh-my-zsh
|
||
|
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/brew-cask/brew-cask.plugin.zsh
|
||
|
#
|
||
|
# The MIT License (MIT)
|
||
|
#
|
||
|
# Copyright (c) 2009-2016 Robby Russell and contributors
|
||
|
# See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
|
||
|
#
|
||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
# of this software and associated documentation files (the "Software"), to deal
|
||
|
# in the Software without restriction, including without limitation the rights
|
||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
|
# copies of the Software, and to permit persons to whom the Software is
|
||
|
# furnished to do so, subject to the following conditions:
|
||
|
#
|
||
|
# The above copyright notice and this permission notice shall be included in all
|
||
|
# copies or substantial portions of the Software.
|
||
|
#
|
||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
|
# SOFTWARE.
|
||
|
|
||
|
__brew_all_casks() {
|
||
|
brew cask search
|
||
|
}
|
||
|
|
||
|
__brew_installed_casks() {
|
||
|
brew cask list|sed 's/(!)//'
|
||
|
}
|
||
|
|
||
|
_brew_cask()
|
||
|
{
|
||
|
local curcontext="$curcontext" state state_descr line
|
||
|
typeset -A opt_args
|
||
|
|
||
|
_arguments -C \
|
||
|
':subcmd:->subcmd' \
|
||
|
'*::options:->options'
|
||
|
|
||
|
case $state in
|
||
|
(subcmd)
|
||
|
local -a subcommands
|
||
|
subcommands=(
|
||
|
'audit:verifies installability of Casks'
|
||
|
'cat:dump raw source of the given Cask to the standard output'
|
||
|
'cleanup:cleans up cached downloads and tracker symlinks'
|
||
|
'create:creates the given Cask and opens it in an editor'
|
||
|
'doctor:checks for configuration issues'
|
||
|
'edit:edits the given Cask'
|
||
|
'fetch:downloads remote application files to local cache'
|
||
|
'home:opens the homepage of the given Cask'
|
||
|
'info:displays information about the given Cask'
|
||
|
'install:installs the given Cask'
|
||
|
'list:with no args, lists installed Casks; given installed Casks, lists staged files'
|
||
|
'search:searches all known Casks'
|
||
|
'style:checks Cask style using RuboCop'
|
||
|
'uninstall:uninstalls the given Cask'
|
||
|
"update:a synonym for 'brew update'"
|
||
|
'zap:zaps all files associated with the given 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 ;;
|
||
|
audit|cat|edit|fetch|home|info|install|zap)
|
||
|
casks=($(__brew_all_casks))
|
||
|
_wanted casks expl 'all casks' compadd -a casks ;;
|
||
|
esac ;;
|
||
|
esac
|
||
|
}
|