summaryrefslogtreecommitdiff
path: root/plugins/brew/brew.plugin.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-08-09 17:28:30 -0700
committerTuowen Zhao <ztuowen@gmail.com>2022-08-09 17:28:30 -0700
commit1a6dcd017dbf564058a729032de3db139fcf9c7e (patch)
treee8dad70ff1450f9d7ff9e76510304648108bee56 /plugins/brew/brew.plugin.zsh
parent6e0a7765188ef970d738108d11eaecc7b79a5f5e (diff)
parent97134d1eed19b72a9c4bf90a2effa847221608bf (diff)
downloadzsh-1a6dcd017dbf564058a729032de3db139fcf9c7e.tar.gz
zsh-1a6dcd017dbf564058a729032de3db139fcf9c7e.tar.bz2
zsh-1a6dcd017dbf564058a729032de3db139fcf9c7e.zip
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins/brew/brew.plugin.zsh')
-rw-r--r--plugins/brew/brew.plugin.zsh30
1 files changed, 27 insertions, 3 deletions
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
index 070a083d0..4a2322216 100644
--- a/plugins/brew/brew.plugin.zsh
+++ b/plugins/brew/brew.plugin.zsh
@@ -1,11 +1,35 @@
+if (( ! $+commands[brew] )); then
+ if [[ -x /opt/homebrew/bin/brew ]]; then
+ BREW_LOCATION="/opt/homebrew/bin/brew"
+ elif [[ -x /usr/local/bin/brew ]]; then
+ BREW_LOCATION="/usr/local/bin/brew"
+ elif [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
+ BREW_LOCATION="/home/linuxbrew/.linuxbrew/bin/brew"
+ elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then
+ BREW_LOCATION="$HOME/.linuxbrew/bin/brew"
+ else
+ return
+ fi
+fi
+
+if [[ -z "$HOMEBREW_PREFIX" ]]; then
+ if [[ -z $BREW_LOCATION ]]; then
+ eval "$(brew shellenv)"
+ else
+ eval "$("$BREW_LOCATION" shellenv)"
+ fi
+fi
+
+unset BREW_LOCATION
+
+alias bcubc='brew upgrade --cask && brew cleanup'
+alias bcubo='brew update && brew outdated --cask'
alias brewp='brew pin'
alias brewsp='brew list --pinned'
-alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
+alias bubo='brew update && brew outdated'
alias bubu='bubo && bubc'
alias buf='brew upgrade --formula'
-alias bcubo='brew update && brew outdated --cask'
-alias bcubc='brew upgrade --cask && brew cleanup'
function brews() {
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"