improve brew info

* Show pinned and keg-only as attributes, where pinned
  version is shown as well.
* Use brackets instead of parentheses to distinguish formula
  attributes(e.g. keg-only) with spec attributes(e.g. bottled)
* Don't show blank line for formula without homepage.
* Don't show duplicated keg-only message which will be shown later
  in caveats.
* Underline urls.
* Remove unnecessary github_info return value check, which is always
  existed.

Closes Homebrew/homebrew#46037.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-11-16 20:10:25 +08:00
parent 02d7abe2ec
commit 14fbc8c39e

View File

@ -105,18 +105,13 @@ module Homebrew
specs << "HEAD" if f.head specs << "HEAD" if f.head
puts "#{f.full_name}: #{specs*", "}#{" (pinned)" if f.pinned?}" attrs = []
attrs << "pinned at #{f.pinned_version}" if f.pinned?
attrs << "keg-only" if f.keg_only?
puts "#{f.full_name}: #{specs * ", "}#{" [#{attrs * ", "}]" if attrs.any?}"
puts f.desc if f.desc puts f.desc if f.desc
puts "#{Tty.em}#{f.homepage}#{Tty.reset}" if f.homepage
puts f.homepage
if f.keg_only?
puts
puts "This formula is keg-only."
puts f.keg_only_reason
puts
end
conflicts = f.conflicts.map(&:name).sort! conflicts = f.conflicts.map(&:name).sort!
puts "Conflicts with: #{conflicts*", "}" unless conflicts.empty? puts "Conflicts with: #{conflicts*", "}" unless conflicts.empty?
@ -132,8 +127,7 @@ module Homebrew
puts "Not installed" puts "Not installed"
end end
history = github_info(f) puts "From: #{Tty.em}#{github_info(f)}#{Tty.reset}"
puts "From: #{history}" if history
unless f.deps.empty? unless f.deps.empty?
ohai "Dependencies" ohai "Dependencies"