From ad861d3b45190053deba73392b128805f37b06d1 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sat, 15 Sep 2018 01:45:57 -0500 Subject: [PATCH] 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. --- modules/homebrew/README.md | 3 --- modules/homebrew/init.zsh | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/homebrew/README.md b/modules/homebrew/README.md index 1a6df51..3046f98 100644 --- a/modules/homebrew/README.md +++ b/modules/homebrew/README.md @@ -29,12 +29,9 @@ Aliases ### Homebrew Cask - `cask` is aliased to `brew cask`. - - `caskc` cleans up old cached downloads. - - `caskC` cleans up all cached downloads. - `caski` installs a cask. - `caskl` lists installed casks. - `casko` lists casks which have an update available. - - `casks` searches for a cask. - `caskx` uninstalls a cask. Authors diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index 12acf59..0133447 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -36,10 +36,21 @@ alias brewx='brew remove' # Homebrew Cask alias cask='brew cask' -alias caskc='brew cask cleanup --outdated' -alias caskC='brew cask cleanup' +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='brew cask search' +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} +}