Skip to content

Instantly share code, notes, and snippets.

@tehprofessor
Created May 24, 2018 20:15
Show Gist options
  • Save tehprofessor/53dde44fd144ac893b1d8c84d66d5618 to your computer and use it in GitHub Desktop.
Save tehprofessor/53dde44fd144ac893b1d8c84d66d5618 to your computer and use it in GitHub Desktop.
Fixes Homebrew's annoying upgrade/update behaviour, will break `update --merge` functionality but quite honestly, IDGAF.
brew() {
local cmd=$1; shift
if test "$cmd" = 'upgrade' || test "$cmd" = 'update'; then
"__brew_update_or_upgrade" "$@"
else
command brew "$cmd" "$@"
fi
}
__brew_update_or_upgrade() {
local maybe_package=$1;
if test -z "$maybe_package"; then
command brew update
else
command brew upgrade "$maybe_package" "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment