21 lines
599 B
Bash
Executable file
21 lines
599 B
Bash
Executable file
#!/bin/bash
|
|
|
|
[ ! -x "$(which brew 2>/dev/null)" -a ! -d /opt/homebrew-cask ] && exit 1
|
|
|
|
function __remove-cask {
|
|
caskBasePath="/opt/homebrew-cask/Caskroom"
|
|
local cask="$1"
|
|
local caskDirectory="$caskBasePath/$cask"
|
|
local versionsToRemove="$(ls -r $caskDirectory | sed 1,1d)"
|
|
if [[ -n $versionsToRemove ]]; then
|
|
while read versionToRemove ; do
|
|
echo "Removing $cask $versionToRemove..."
|
|
rm -rf "$caskDirectory/$versionToRemove"
|
|
done <<< "$versionsToRemove"
|
|
fi
|
|
}
|
|
|
|
while read cask; do
|
|
__remove-cask "$cask"
|
|
done <<< "$(brew cask list)"
|