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:
Jahir Vidrio 2026-04-30 23:48:32 -06:00
commit ed87310ea7
2 changed files with 61 additions and 46 deletions

View file

@ -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

View file

@ -34,6 +34,7 @@ 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
if zstyle -T ':omz:plugins:brew' aliases; then
alias ba='brew autoremove' alias ba='brew autoremove'
alias bcfg='brew config' alias bcfg='brew config'
alias bci='brew info --cask' alias bci='brew info --cask'
@ -83,3 +84,4 @@ function brews() {
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