Merge pull request #13693 from FnControlHomebrew/info

info: highlight package name
This commit is contained in:
Mike McQuaid 2022-08-15 16:23:08 +01:00 committed by GitHub
commit c7df26fed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -8,7 +8,7 @@ describe Cask::Cmd::Info, :cask do
expect {
described_class.run("local-transmission")
}.to output(<<~EOS).to_stdout
local-transmission: 2.61
==> local-transmission: 2.61
https://transmissionbt.com/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb
@ -25,7 +25,7 @@ describe Cask::Cmd::Info, :cask do
expect {
described_class.run("with-auto-updates")
}.to output(<<~EOS).to_stdout
with-auto-updates: 1.0 (auto_updates)
==> with-auto-updates: 1.0 (auto_updates)
https://brew.sh/autoupdates
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-auto-updates.rb
@ -41,7 +41,7 @@ describe Cask::Cmd::Info, :cask do
describe "given multiple Casks" do
let(:expected_output) {
<<~EOS
local-caffeine: 1.2.3
==> local-caffeine: 1.2.3
https://brew.sh/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-caffeine.rb
@ -52,7 +52,7 @@ describe Cask::Cmd::Info, :cask do
==> Artifacts
Caffeine.app (App)
local-transmission: 2.61
==> local-transmission: 2.61
https://transmissionbt.com/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb
@ -76,7 +76,7 @@ describe Cask::Cmd::Info, :cask do
expect {
described_class.run("with-caveats")
}.to output(<<~EOS).to_stdout
with-caveats: 1.2.3
==> with-caveats: 1.2.3
https://brew.sh/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-caveats.rb
@ -103,7 +103,7 @@ describe Cask::Cmd::Info, :cask do
expect {
described_class.run("with-conditional-caveats")
}.to output(<<~EOS).to_stdout
with-conditional-caveats: 1.2.3
==> with-conditional-caveats: 1.2.3
https://brew.sh/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-conditional-caveats.rb
@ -120,7 +120,7 @@ describe Cask::Cmd::Info, :cask do
expect {
described_class.run("with-languages")
}.to output(<<~EOS).to_stdout
with-languages: 1.2.3
==> with-languages: 1.2.3
https://brew.sh/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-languages.rb
@ -139,7 +139,7 @@ describe Cask::Cmd::Info, :cask do
expect {
described_class.run("without-languages")
}.to output(<<~EOS).to_stdout
without-languages: 1.2.3
==> without-languages: 1.2.3
https://brew.sh/
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/without-languages.rb

View File

@ -103,7 +103,7 @@ describe Homebrew::MissingFormula do
let(:formula) { "local-caffeine" }
let(:show_info) { true }
it { is_expected.to match(/Found a cask named "local-caffeine" instead.\n\nlocal-caffeine: 1.2.3\n/) }
it { is_expected.to match(/Found a cask named "local-caffeine" instead.\n\n==> local-caffeine: 1.2.3\n/) }
end
context "with a formula name that is not a cask" do

View File

@ -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).