diff options
| author | Aditya <bluenerd@protonmail.com> | 2023-02-27 20:04:56 +0530 | 
|---|---|---|
| committer | Aditya <bluenerd@protonmail.com> | 2023-02-27 20:04:56 +0530 | 
| commit | edc449275b6c04445f58b108ca0937a87c1e8430 (patch) | |
| tree | 9fd484d58145b616f29a78857cc0b1c8b1c18f05 /oh-my-zsh/plugins/brew/brew.plugin.zsh | |
| parent | 6f5424ca96c4221ef433f545642669e9c104d0ed (diff) | |
add zsh
Diffstat (limited to 'oh-my-zsh/plugins/brew/brew.plugin.zsh')
| -rw-r--r-- | oh-my-zsh/plugins/brew/brew.plugin.zsh | 48 | 
1 files changed, 48 insertions, 0 deletions
diff --git a/oh-my-zsh/plugins/brew/brew.plugin.zsh b/oh-my-zsh/plugins/brew/brew.plugin.zsh new file mode 100644 index 0000000..ea89008 --- /dev/null +++ b/oh-my-zsh/plugins/brew/brew.plugin.zsh @@ -0,0 +1,48 @@ +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 + +  # 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 +fi + +if [[ -z "$HOMEBREW_PREFIX" ]]; then +  # Maintain compatability with potential custom user profiles, where we had +  # 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)" +fi + +alias bcubc='brew upgrade --cask && brew cleanup' +alias bcubo='brew update && brew outdated --cask' +alias brewp='brew pin' +alias brewsp='brew list --pinned' +alias bubc='brew upgrade && brew cleanup' +alias bubo='brew update && brew outdated' +alias bubu='bubo && bubc' +alias buf='brew upgrade --formula' + +function brews() { +  local formulae="$(brew leaves | xargs brew deps --installed --for-each)" +  local casks="$(brew list --cask 2>/dev/null)" + +  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}" +}  | 
