Created
September 7, 2016 20:08
-
-
Save tko/7d47b18a7d61ff902630b09a2ef920c6 to your computer and use it in GitHub Desktop.
list installed casks that have newer versions available https://caskroom.github.io/
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
#!/usr/bin/env bash | |
set -e | |
contains() { | |
local needle=$1 | |
for x in "${@:2}"; do | |
[[ "$x" == "$needle" ]] && return 0 | |
done | |
return 1 | |
} | |
main() { | |
brew cask list --versions | while read -r -a versions; do | |
cask=${versions[0]} | |
unset versions[0] | |
version=$(brew cask _stanza version "${cask}") | |
if ! contains "${version}" "${versions[@]}"; then | |
latest=${versions[*]: -1} | |
if [[ -t 1 ]]; then | |
echo "${cask}: ${latest} -> ${version}" | |
else | |
echo "${cask}" | |
fi | |
fi | |
done | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment