Skip to content

Instantly share code, notes, and snippets.

@toonetown
Last active November 30, 2017 15:30
Show Gist options
  • Save toonetown/657606a8bac754eb2856f53e5001b4a3 to your computer and use it in GitHub Desktop.
Save toonetown/657606a8bac754eb2856f53e5001b4a3 to your computer and use it in GitHub Desktop.
###########
# Adds "upgrade" to `brew cask`. Accepts "--greedy" as an option. Just delegates to "reinstall"
#
#!/bin/bash
set -o pipefail
source /etc/profile
GREEDY=""
if [ "${1}" == "--greedy" ]; then GREEDY="${1}"; shift; fi
if [ $# -eq 0 ]; then
ARGS=($(brew cask outdated ${GREEDY} --verbose | grep -v '(latest)' | cut -d' ' -f1))
else
ARGS=("$@")
fi
if [ ${#ARGS[@]} -gt 0 ]; then
echo "Upgrading casks ${ARGS[@]}..."
brew cask reinstall "${ARGS[@]}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment