Summary
fishでもbrew cask upgradeをしたいbrew_cask_upgrade.fish
This file contains 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
function brew_cask_upgrade | |
for app in (brew cask list) | |
set --local latest (brew cask info $app | awk 'NR==1{print $2}') | |
set --local versions (ls -1 "/usr/local/Caskroom/$app/.metadata/") | |
set --local current (echo $versions | awk '{print $NF}') | |
echo "app: $app" | |
echo "latest: $latest" | |
echo "versions: $versions" | |
echo "current: $current" | |
if [ $latest = "latest" ] | |
echo "[!] $app: $current == $latest" | |
if [ $argv[1] = "-f" ] | |
brew cask install "$app" --force | |
end | |
continue | |
else if [ "$current" = "$latest" ] | |
continue | |
end | |
echo "[+] $app: $current -> $latest" | |
brew cask uninstall "$app" --force | |
brew cask install "$app" | |
end | |
end |
Reference
Qiita - 2k0ri - 2017-01-23 - brew caskのappどもをupgradeするhttp://qiita.com/2k0ri/items/9fe8d33a72dbfb15fe6b