From 14fbc8c39e339bbcd2927bc18219c52fbb1898ff Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Mon, 16 Nov 2015 20:10:25 +0800 Subject: [PATCH] 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 --- Library/Homebrew/cmd/info.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 52d39ca15c..70c1a2c9ea 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -105,18 +105,13 @@ module Homebrew 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.homepage - - if f.keg_only? - puts - puts "This formula is keg-only." - puts f.keg_only_reason - puts - end + puts "#{Tty.em}#{f.homepage}#{Tty.reset}" if f.homepage conflicts = f.conflicts.map(&:name).sort! puts "Conflicts with: #{conflicts*", "}" unless conflicts.empty? @@ -132,8 +127,7 @@ module Homebrew puts "Not installed" end - history = github_info(f) - puts "From: #{history}" if history + puts "From: #{Tty.em}#{github_info(f)}#{Tty.reset}" unless f.deps.empty? ohai "Dependencies"