From 426737eb9eb1effdf144d9eeed8cde8b5a7d34db Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 1 Aug 2014 17:45:37 +0200 Subject: [PATCH] outdated: allow passing formulae as arguments. If formulae names are passed as arguments check if just they are outdated. Additionally, return a failed code if they are outdated. This will hopefully be able to stop people complaining about the outdated error code as they can now just run e.g.: `brew outdated git && brew upgrade git` Closes Homebrew/homebrew#31242. Signed-off-by: Mike McQuaid --- Library/Homebrew/cmd/outdated.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index d13e7d0c6b..f90e933f30 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -10,10 +10,12 @@ module Homebrew puts f.name end end + Homebrew.failed = ARGV.formulae.any? && outdated_brews.any? end def outdated_brews - Formula.installed.map do |f| + brews = ARGV.formulae.any? ? ARGV.formulae : Formula.installed + brews.map do |f| versions = f.rack.subdirs.map { |d| Keg.new(d).version }.sort! if versions.all? { |version| f.pkg_version > version } yield f, versions if block_given?