2022-07-12 18:40:39 +02:00
|
|
|
if (( ! $+commands[brew] )); then
|
2023-09-13 10:48:16 +02:00
|
|
|
if [[ -n "$BREW_LOCATION" ]]; then
|
|
|
|
if [[ ! -x "$BREW_LOCATION" ]]; then
|
|
|
|
echo "[oh-my-zsh] $BREW_LOCATION is not executable"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
elif [[ -x /opt/homebrew/bin/brew ]]; then
|
2022-07-12 18:40:39 +02:00
|
|
|
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
|
2022-10-14 20:27:42 +02:00
|
|
|
|
|
|
|
# Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
|
|
|
|
# not already on the path, to prevent duplicate entries. This aligns with
|
|
|
|
# the behavior of the brew installer.sh post-install steps.
|
|
|
|
eval "$("$BREW_LOCATION" shellenv)"
|
|
|
|
unset BREW_LOCATION
|
2022-07-12 18:40:39 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
2024-09-01 21:01:27 +02:00
|
|
|
# Maintain compatibility with potential custom user profiles, where we had
|
2022-10-14 20:27:42 +02:00
|
|
|
# previously relied on always sourcing shellenv. OMZ plugins should not rely
|
|
|
|
# on this to be defined due to out of order processing.
|
|
|
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
2022-07-12 18:40:39 +02:00
|
|
|
fi
|
|
|
|
|
2023-06-15 11:01:02 +02:00
|
|
|
if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
|
|
|
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
|
|
|
fi
|
|
|
|
|
2024-07-22 23:21:02 +02:00
|
|
|
alias ba='brew autoremove'
|
2020-05-04 15:46:27 +02:00
|
|
|
alias bci='brew info --cask'
|
|
|
|
alias bcin='brew install --cask'
|
|
|
|
alias bcl='brew list --cask'
|
2024-07-27 16:44:20 +02:00
|
|
|
alias bcn='brew cleanup'
|
2020-05-04 15:46:27 +02:00
|
|
|
alias bco='brew outdated --cask'
|
|
|
|
alias bcrin='brew reinstall --cask'
|
2022-07-12 18:40:39 +02:00
|
|
|
alias bcubc='brew upgrade --cask && brew cleanup'
|
|
|
|
alias bcubo='brew update && brew outdated --cask'
|
2020-05-04 15:46:27 +02:00
|
|
|
alias bcup='brew upgrade --cask'
|
|
|
|
alias bfu='brew upgrade --formula'
|
2022-02-07 09:26:12 +01:00
|
|
|
alias bi='brew install'
|
2020-05-04 15:46:27 +02:00
|
|
|
alias bl='brew list'
|
|
|
|
alias bo='brew outdated'
|
2018-08-29 20:53:24 +02:00
|
|
|
alias brewp='brew pin'
|
|
|
|
alias brewsp='brew list --pinned'
|
2021-09-24 22:12:45 +02:00
|
|
|
alias bsl='brew services list'
|
|
|
|
alias bsoff='brew services stop'
|
|
|
|
alias bsoffa='bsoff --all'
|
|
|
|
alias bson='brew services start'
|
|
|
|
alias bsona='bson --all'
|
|
|
|
alias bsr='brew services run'
|
|
|
|
alias bsra='bsr --all'
|
2020-05-04 15:46:27 +02:00
|
|
|
alias bu='brew update'
|
2022-07-12 18:40:39 +02:00
|
|
|
alias bubo='brew update && brew outdated'
|
2019-12-29 17:53:50 +01:00
|
|
|
alias bubu='bubo && bup'
|
2023-01-09 20:07:41 +01:00
|
|
|
alias bubug='bubo && bugbc'
|
2020-05-04 15:46:27 +02:00
|
|
|
alias bugbc='brew upgrade --greedy && brew cleanup'
|
|
|
|
alias bup='brew upgrade'
|
2023-01-09 20:02:44 +01:00
|
|
|
alias buz='brew uninstall --zap'
|
2021-12-18 01:15:39 +01:00
|
|
|
|
|
|
|
function brews() {
|
|
|
|
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
|
2022-11-03 18:32:01 +01:00
|
|
|
local casks="$(brew list --cask 2>/dev/null)"
|
2021-12-18 01:15:39 +01:00
|
|
|
|
|
|
|
local blue="$(tput setaf 4)"
|
|
|
|
local bold="$(tput bold)"
|
|
|
|
local off="$(tput sgr0)"
|
|
|
|
|
|
|
|
echo "${blue}==>${off} ${bold}Formulae${off}"
|
|
|
|
echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/"
|
|
|
|
echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}"
|
|
|
|
}
|