info: always mark currently linked keg with *

When multiple kegs are installed, `brew info` marks a keg with an
asterisk if f.installed_prefix == keg, but this is only true if either
HEAD or the newest version of the formula is installed. This isn't
always useful, so let's mark the currently linked keg with an asterisk
regardless of the version.

Obviously, keg-only formula will never be marked, but this is probably a
feature. When multiple keg-only kegs exist, chances are that they are
each being utilized by something, so there isn't really a "used" and
"unused" version.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-01-01 15:27:21 -06:00
parent d2bf7b4e2c
commit 6858c00feb

View File

@ -1,5 +1,6 @@
require 'formula' require 'formula'
require 'tab' require 'tab'
require 'keg'
module Homebrew extend self module Homebrew extend self
def info def info
@ -56,7 +57,7 @@ module Homebrew extend self
kegs.each do |keg| kegs.each do |keg|
next if keg.basename.to_s == '.DS_Store' next if keg.basename.to_s == '.DS_Store'
print "#{keg} (#{keg.abv})" print "#{keg} (#{keg.abv})"
print " *" if f.installed_prefix == keg and kegs.length > 1 print " *" if Keg.new(keg).linked? and kegs.length > 1
puts puts
tab = Tab.for_keg keg tab = Tab.for_keg keg
unless tab.used_options.empty? unless tab.used_options.empty?