Move cask-tidy out to its own script.
This commit is contained in:
parent
d9634565e4
commit
42204c5c9b
18
bin/cask-tidy
Executable file
18
bin/cask-tidy
Executable 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)"
|
|
@ -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 "#-------------------------------"
|
||||
|
|
Loading…
Reference in a new issue