Created
November 1, 2016 12:33
-
-
Save linktohack/e523bdc195dcc2dc6d2249181b92230e to your computer and use it in GitHub Desktop.
Oudated Cask (-q + grep to script)
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
function cask-outdated() { | |
local INFO | |
local OUTDATED | |
local LATEST | |
local c | |
local available | |
local installed | |
for c in $(brew cask list); do | |
INFO=$(cask info $c 2>&1) | |
available=$(echo $INFO | head -n1 | cut -f2 -d ' ') | |
installed=$(echo $INFO | head -n3 | tail -n1 | sed -e 's|.*/||g' | cut -d' ' -f1) | |
if [[ "$installed" == "latest" ]]; then | |
LATEST="$LATEST $c" | |
[[ "$1" == "-q" ]] || echo "$c: latest -> latest" | |
fi | |
if [[ "$available" != "$installed" ]]; then | |
OUTDATED="$OUTDATED $c" | |
[[ "$1" == "-q" ]] || echo "$c: $installed -> $available" | |
fi | |
done | |
echo "OUTDATED:$OUTDATED" | |
echo "LATEST:$LATEST" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment