Move cask-tidy out to its own script.

This commit is contained in:
Scott Wallace 2016-03-11 19:49:30 +00:00
parent d9634565e4
commit 42204c5c9b
2 changed files with 18 additions and 19 deletions

18
bin/cask-tidy Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
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)"

View file

@ -62,25 +62,6 @@ function install_osx_software {
#-------------------------------
}
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
}
function cask-tidy {
while read cask; do
__remove-cask "$cask"
done <<< "$(brew cask list)"
}
echo "#-------------------------------"
echo "# START: $(date)"
echo "#-------------------------------"