Add `homebrew` module

This commit is contained in:
Qi 2018-06-25 22:26:17 -04:00
parent 903954985f
commit 5b164409da
2 changed files with 69 additions and 0 deletions

30
modules/homebrew/README.md Executable file
View File

@ -0,0 +1,30 @@
Homebrew
========
Defines Homebrew aliases.
Aliases
-------
### Homebrew
- `brewc` cleans outdated brews and their cached archives.
- `brewC` cleans outdated brews, including keg-only, and their cached archives.
- `brewi` installs a formula.
- `brewl` lists installed formulae.
- `brewo` lists brews which have an update available.
- `brews` searches for a formula or a cask.
- `brewu` updates and upgrades Homebrew packages and formulae.
- `brewx` uninstalls a formula.
### 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` print a message telling that `brew cask search` is deprecated.
- `caskx` uninstalls a cask.

39
modules/homebrew/init.zsh Executable file
View File

@ -0,0 +1,39 @@
#
# Defines Homebrew aliases.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
# Qi Zhang <singularitti@outlook.com>
#
# Return if requirements are not found.
if ! [[ "${OSTYPE}" =~ (darwin|linux)* ]]; then
return 1
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='brew cask cleanup --outdated'
alias caskC='brew cask cleanup'
alias caski='brew cask install'
alias caskl='brew cask list'
alias casko='brew cask outdated'
alias caskx='brew cask uninstall'
casks() {
print "Calling \`brew cask search\` is deprecated! Please use \`brews\` instead!"
}