Created
March 9, 2020 16:11
-
-
Save kernelhcy/bb144b0299f8cb01b2ef2ac78f6434cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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