Created
December 2, 2013 14:24
-
-
Save jaymecd/7750203 to your computer and use it in GitHub Desktop.
Brew cask helpers (OSX)
This file contains hidden or 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_install() { | |
if brew cask info "${@}" | grep "Not installed" > /dev/null; then | |
brew cask install "${@}" | |
else | |
echo "${@} is already installed." | |
fi | |
} | |
function cask_upgrade() { | |
if brew cask info "${@}" | grep "Not installed" > /dev/null; then | |
echo "${@} is not installed." | |
else | |
brew cask install --force "${@}" | |
fi | |
} | |
function cask_cleanup() { | |
local caskroom="/opt/homebrew-cask/Caskroom" | |
for app in $(/usr/bin/find "$caskroom" -depth 1 -type d); do | |
if [[ $(/usr/bin/find "$app" -depth 1 -type d | wc -l) -gt 1 ]]; then | |
echo -n "$(basename "$app"):" | |
for version in $(/bin/ls -1t "$app" | /usr/bin/tail -n+2); do | |
echo -n " $version " | |
rm -rf "$app/$version" | |
done | |
echo | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment