From a208ea9c9237daa66ebef4f2d666a715fca36e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?fn=20=E2=8C=83=20=E2=8C=A5?= <70830482+FnControlOption@users.noreply.github.com> Date: Fri, 12 Aug 2022 23:44:45 -0700 Subject: [PATCH] info: highlight package name --- Library/Homebrew/cask/cmd/info.rb | 2 +- Library/Homebrew/cmd/info.rb | 2 +- Library/Homebrew/utils.rb | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/cmd/info.rb b/Library/Homebrew/cask/cmd/info.rb index c5d4d9a410..343390a4b1 100644 --- a/Library/Homebrew/cask/cmd/info.rb +++ b/Library/Homebrew/cask/cmd/info.rb @@ -79,7 +79,7 @@ module Cask end def self.title_info(cask) - title = "#{cask.token}: #{cask.version}" + title = "#{oh1_title(cask.token)}: #{cask.version}" title += " (auto_updates)" if cask.auto_updates title end diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 4f6d706567..ba91a20fd0 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -274,7 +274,7 @@ module Homebrew attrs << "pinned at #{f.pinned_version}" if f.pinned? attrs << "keg-only" if f.keg_only? - puts "#{f.full_name}: #{specs * ", "}#{" [#{attrs * ", "}]" unless attrs.empty?}" + puts "#{oh1_title(f.full_name)}: #{specs * ", "}#{" [#{attrs * ", "}]" unless attrs.empty?}" puts f.desc if f.desc puts Formatter.url(f.homepage) if f.homepage diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 9104ba1b37..c521ad2891 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -125,7 +125,7 @@ module Kernel puts sput unless sput.empty? end - def oh1(title, truncate: :auto) + def oh1_title(title, truncate: :auto) verbose = if respond_to?(:verbose?) verbose? else @@ -133,7 +133,11 @@ module Kernel end title = Tty.truncate(title) if $stdout.tty? && !verbose && truncate == :auto - puts Formatter.headline(title, color: :green) + Formatter.headline(title, color: :green) + end + + def oh1(title, truncate: :auto) + puts oh1_title(title, truncate: truncate) end # Print a message prefixed with "Warning" (do this rarely).