prezto/modules/homebrew/init.zsh
Indrajit Raychaudhuri ad861d3b45 homebrew: Replace deprecated casks with their brew counterpart
Homebrew has deprecated `brew cask cleanup` and `brew cask search` in favor
of `brew cleanup` and `brew search` respectively. They will stop working on
2018-09-30. Further, `--outdated` has been removed.

We should eventually remove the related aliases, but for a while we keep
supporting them gracefully with deprecation warning.

The documentation has been removed from README.md, however.
2018-09-15 13:04:07 -05:00

57 lines
1.2 KiB
Bash

#
# Defines Homebrew aliases.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Return if requirements are not found.
if [[ "$OSTYPE" != (darwin|linux)* ]]; then
return 1
fi
#
# Environmental Variables
#
# Load standard Homebrew shellenv into the shell session.
# `brew shellenv` is relatively new, guard for legacy Homebrew.
if (( $+commands[brew] )); then
eval "$(brew shellenv 2> /dev/null)"
fi
#
# Aliases
#
# Homebrew
alias brewc='brew cleanup'
alias brewC='brew cleanup --force'
alias brewi='brew install'
alias brewl='brew list'
alias brewo='brew outdated'
alias brews='brew search'
alias brewu='brew update && brew upgrade'
alias brewx='brew remove'
# Homebrew Cask
alias cask='brew cask'
alias caskc='hb_deprecated brew cask cleanup'
alias caskC='hb_deprecated brew cask cleanup'
alias caski='brew cask install'
alias caskl='brew cask list'
alias casko='brew cask outdated'
alias casks='hb_deprecated brew cask search'
alias caskx='brew cask uninstall'
function hb_deprecated {
local cmd="${argv[3]}"
local cmd_args=( ${(@)argv:4} )
printf "'brew cask %s' has been deprecated, " "${cmd}"
printf "using 'brew %s' instead\n" "${cmd}"
cmd_args=( ${(@)argv:4} )
command brew "${cmd}" ${(@)cmd_args}
}