こんにちは。
homebrew で動かすことが多い brew コマンド(複数)はまとめてスクリプト化。
#!/usr/bin/ruby
require 'yaml'
brewcmds_yml = <<EOS
- "brew list --versions \| awk '{printf(\\"%-18s %s\\\\n\\",$1,$NF)}'"
- "brew cask list \| cut -d' ' -f1 \| xargs -I % bash -c \\"echo -n %' '; ls -C /opt/homebrew-cask/Caskroom/%\\" \| awk '{printf(\\"%-18s\\",$1);$1=\\"\\";print}'"
- "brew --config"
- "brew tap"
- "brew update"
- "brew doctor"
- "brew outdated"
EOS
for brewcmd in YAML.load(brewcmds_yml)
puts "% " + brewcmd.gsub(/\|.*/, "")
puts `#{brewcmd + " 2>&1"}` # for sh/bash
end
brewcmd = "brew outdated"
brew_outdated = `#{brewcmd + " 2>&1"}`.gsub(/\n/, " ") # for sh/bash
puts "% " + brewcmd
puts `brew info #{brew_outdated}` unless brew_outdated.empty?
exit(0)
- brew cask list +バージョン表示 も加えてあります。