Skip to content

Instantly share code, notes, and snippets.

@linktohack
Created November 1, 2016 12:33
Show Gist options
  • Save linktohack/e523bdc195dcc2dc6d2249181b92230e to your computer and use it in GitHub Desktop.
Save linktohack/e523bdc195dcc2dc6d2249181b92230e to your computer and use it in GitHub Desktop.
Oudated Cask (-q + grep to script)
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