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 <mike@mikemcquaid.com>
This commit is contained in:
parent
c043a93bdf
commit
426737eb9e
@ -10,10 +10,12 @@ module Homebrew
|
|||||||
puts f.name
|
puts f.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Homebrew.failed = ARGV.formulae.any? && outdated_brews.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def outdated_brews
|
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!
|
versions = f.rack.subdirs.map { |d| Keg.new(d).version }.sort!
|
||||||
if versions.all? { |version| f.pkg_version > version }
|
if versions.all? { |version| f.pkg_version > version }
|
||||||
yield f, versions if block_given?
|
yield f, versions if block_given?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user