Skip to content

Instantly share code, notes, and snippets.

@kernelhcy
Created March 9, 2020 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kernelhcy/bb144b0299f8cb01b2ef2ac78f6434cf to your computer and use it in GitHub Desktop.
Save kernelhcy/bb144b0299f8cb01b2ef2ac78f6434cf to your computer and use it in GitHub Desktop.
#!/bin/bash
# <bitbar.title>Homebrew Updates</bitbar.title>
# <bitbar.author>killercup</bitbar.author>
# <bitbar.author.github>killercup</bitbar.author.github>
# <bitbar.desc>List available updates from Homebrew (OS X)</bitbar.desc>
exit_with_error() {
echo "err | color=red";
exit 1;
}
/usr/local/bin/brew update > /dev/null || exit_with_error;
PINNED=$(/usr/local/bin/brew list --pinned);
OUTDATED=$(/usr/local/bin/brew outdated --quiet);
UPDATES=$(comm -13 <(for X in "${PINNED[@]}"; do echo "${X}"; done) <(for X in "${OUTDATED[@]}"; do echo "${X}"; done))
UPDATE_COUNT=$(echo "$UPDATES" | grep -c '[^[:space:]]');
#echo "↑$UPDATE_COUNT | dropdown=false"
echo "brew updates: $UPDATE_COUNT | href="
for i in $UPDATES
do
echo "-- $i | href="
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment