diff --git a/Library/Contributions/examples/brew-fetch.rb b/Library/Contributions/examples/brew-fetch.rb index 73e1f6a87d..a3fb293203 100755 --- a/Library/Contributions/examples/brew-fetch.rb +++ b/Library/Contributions/examples/brew-fetch.rb @@ -1,7 +1,13 @@ # Downloads the tarballs for the given formulae to the Cache require 'formula' +require 'fileutils' ARGV.formulae.each do |f| + if ARGV.include? "--force" or ARGV.include? "-f" + where_to = `brew --cache #{f.name}`.strip + FileUtils.rm_rf where_to unless where_to.empty? + end + f.downloader.fetch end