commit 59b69fd5059fc70b843acab4bc5c19b2f32b3fff parent 962590a825b20127400e54d4c916b12a58f71f0b Author: Alex Balgavy <a.balgavy@gmail.com> Date: Wed, 23 May 2018 14:34:39 +0200 Separated upgrade programs & casks Diffstat:
M | commonprofile | | | 32 | +++++++++++++++++++++++++++----- |
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/commonprofile b/commonprofile @@ -55,14 +55,16 @@ notify() { brewmaster() { brew update; brew update > /dev/null; - outdated="$(brew outdated) $(brew cask outdated --greedy)" + outdated="$(brew outdated)" + outdated_c="$(brew cask outdated --greedy)" + + # Potentially upgrade programs if [ ${#outdated} = 1 ]; then - echo "Nothing to update." + echo "No programs to update." else echo "\nTo update:\n" brew outdated; - brew cask outdated --greedy; - notify "Finished reading updates" "Click to view outdated packages." + notify "Brew: Finished reading updates" "Click to view outdated packages." echo -n "Continue? [Y/n]" read -sqn CONF @@ -70,14 +72,34 @@ brewmaster() { echo "\nUser cancelled." return 1 fi - echo "\nContinuing with upgrade." + echo "\nContinuing with brew upgrade." brew upgrade; + fi + + # Potentially upgrade casks + if [ ${#outdated_c} = 1 ]; then + echo "No casks to update." + else + echo "\nCasks to update:\n" + brew cask outdated --greedy; + notify "Cask: Finished reading updates" "Click to view outdated casks." + echo -n "Continue? [Y/n]" + read -sqn CONF + + if [ "$CONF" != "y" ]; then + echo "\nUser cancelled." + return 1 + fi + echo "\nContinuing with cask upgrade." brew cask upgrade --greedy; fi + + # Final steps & cleanup brew cleanup -s; brew cask cleanup; brew prune; brew doctor; + brew missing; notify "Brewed." "All packages have been upgraded."; }