mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
feat(brew): ✨ Add option to disable aliases
Allow users to opt-out of default aliases by setting `zstyle :omz:plugins:brew aliases no`. Aliases remain enabled by default to maintain backward compatibility.
This commit is contained in:
parent
e7aa0c56e6
commit
ed87310ea7
2 changed files with 61 additions and 46 deletions
|
|
@ -8,6 +8,19 @@ To use it, add `brew` to the plugins array of your zshrc file:
|
||||||
plugins=(... brew)
|
plugins=(... brew)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
### Aliases
|
||||||
|
|
||||||
|
If you don't want to use the aliases provided by this plugin, you can disable them by setting the following style
|
||||||
|
in your `.zshrc` file, before Oh My Zsh is sourced:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:brew' aliases no
|
||||||
|
```
|
||||||
|
|
||||||
|
Default: `yes`.
|
||||||
|
|
||||||
## Shellenv
|
## Shellenv
|
||||||
|
|
||||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common locations, and execute
|
If `brew` is not found in the PATH, this plugin will attempt to find it in common locations, and execute
|
||||||
|
|
|
||||||
|
|
@ -34,52 +34,54 @@ if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
||||||
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias ba='brew autoremove'
|
if zstyle -T ':omz:plugins:brew' aliases; then
|
||||||
alias bcfg='brew config'
|
alias ba='brew autoremove'
|
||||||
alias bci='brew info --cask'
|
alias bcfg='brew config'
|
||||||
alias bcin='brew install --cask'
|
alias bci='brew info --cask'
|
||||||
alias bcl='brew list --cask'
|
alias bcin='brew install --cask'
|
||||||
alias bcn='brew cleanup'
|
alias bcl='brew list --cask'
|
||||||
alias bco='brew outdated --cask'
|
alias bcn='brew cleanup'
|
||||||
alias bcrin='brew reinstall --cask'
|
alias bco='brew outdated --cask'
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
alias bcrin='brew reinstall --cask'
|
||||||
alias bcubo='brew update && brew outdated --cask'
|
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||||
alias bcup='brew upgrade --cask'
|
alias bcubo='brew update && brew outdated --cask'
|
||||||
alias bdr='brew doctor'
|
alias bcup='brew upgrade --cask'
|
||||||
alias bfu='brew upgrade --formula'
|
alias bdr='brew doctor'
|
||||||
alias bi='brew install'
|
alias bfu='brew upgrade --formula'
|
||||||
alias bih='brew install --HEAD'
|
alias bi='brew install'
|
||||||
alias bl='brew list'
|
alias bih='brew install --HEAD'
|
||||||
alias bo='brew outdated'
|
alias bl='brew list'
|
||||||
alias br='brew reinstall'
|
alias bo='brew outdated'
|
||||||
alias brewp='brew pin'
|
alias br='brew reinstall'
|
||||||
alias brewsp='brew list --pinned'
|
alias brewp='brew pin'
|
||||||
alias brh='brew reinstall --HEAD'
|
alias brewsp='brew list --pinned'
|
||||||
alias bs='brew search'
|
alias brh='brew reinstall --HEAD'
|
||||||
alias bsl='brew services list'
|
alias bs='brew search'
|
||||||
alias bsoff='brew services stop'
|
alias bsl='brew services list'
|
||||||
alias bsoffa='bsoff --all'
|
alias bsoff='brew services stop'
|
||||||
alias bson='brew services start'
|
alias bsoffa='bsoff --all'
|
||||||
alias bsona='bson --all'
|
alias bson='brew services start'
|
||||||
alias bsr='brew services run'
|
alias bsona='bson --all'
|
||||||
alias bsra='bsr --all'
|
alias bsr='brew services run'
|
||||||
alias bu='brew update'
|
alias bsra='bsr --all'
|
||||||
alias bubo='brew update && brew outdated'
|
alias bu='brew update'
|
||||||
alias bubu='bubo && bup'
|
alias bubo='brew update && brew outdated'
|
||||||
alias bubug='bubo && bugbc'
|
alias bubu='bubo && bup'
|
||||||
alias bugbc='brew upgrade --greedy && brew cleanup'
|
alias bubug='bubo && bugbc'
|
||||||
alias bup='brew upgrade'
|
alias bugbc='brew upgrade --greedy && brew cleanup'
|
||||||
alias buz='brew uninstall --zap'
|
alias bup='brew upgrade'
|
||||||
|
alias buz='brew uninstall --zap'
|
||||||
|
|
||||||
function brews() {
|
function brews() {
|
||||||
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
|
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
|
||||||
local casks="$(brew list --cask 2>/dev/null)"
|
local casks="$(brew list --cask 2>/dev/null)"
|
||||||
|
|
||||||
local blue="$(tput setaf 4)"
|
local blue="$(tput setaf 4)"
|
||||||
local bold="$(tput bold)"
|
local bold="$(tput bold)"
|
||||||
local off="$(tput sgr0)"
|
local off="$(tput sgr0)"
|
||||||
|
|
||||||
echo "${blue}==>${off} ${bold}Formulae${off}"
|
echo "${blue}==>${off} ${bold}Formulae${off}"
|
||||||
echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/"
|
echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/"
|
||||||
echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}"
|
echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}"
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue