Created
September 29, 2015 06:28
-
-
Save umi-uyura/475ee08eba84fe02359e to your computer and use it in GitHub Desktop.
Remove applications that depends on the Homebrew Cask
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
#!/usr/bin/env bash | |
# | |
# Remove applications that depends on the Homebrew Cask | |
# | |
CMDNAME=`basename $0` | |
update_mark="" | |
function usage() | |
{ | |
cat << EOF | |
Remove applications that depends on the Homebrew Cask | |
usage : $CMDNAME [option] | |
-r : Rehearsal mode | |
-h : show usage | |
EOF | |
} | |
while getopts rh OPT | |
do | |
case $OPT in | |
r) REHEARSAL_MODE=0 | |
;; | |
h|*) usage | |
exit 1 | |
;; | |
esac | |
done | |
echo "Recommended that you manually keep Delete the app body in advance." | |
echo "" | |
if [[ $REHEARSAL_MODE ]]; then | |
echo "This is Rehearsal mode" | |
echo "" | |
else | |
echo "Are you sure you want to uninstall all of Cask? (yes/no)" | |
read answer | |
if [ "yes" != $answer -a "y" != $answer ]; then | |
exit | |
fi | |
fi | |
no_artifact_apps=() | |
while read line; do | |
if [[ $line =~ \(!\)$ ]]; then | |
no_artifact_apps+=("$line") | |
continue | |
fi | |
if [[ $REHEARSAL_MODE ]]; then | |
echo "brew cask uninstall $line" | |
else | |
#brew cask uninstall $line | |
brew cask zap $line | |
fi | |
done < <(brew cask list -1) | |
echo "" | |
echo "Following application artifact information is nothing" | |
for app in "${no_artifact_apps[@]}" | |
do | |
echo $app | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment