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/test/cask/cmd/info_spec.rb b/Library/Homebrew/test/cask/cmd/info_spec.rb index c127ff6752..34e64cf570 100644 --- a/Library/Homebrew/test/cask/cmd/info_spec.rb +++ b/Library/Homebrew/test/cask/cmd/info_spec.rb @@ -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 diff --git a/Library/Homebrew/test/missing_formula_spec.rb b/Library/Homebrew/test/missing_formula_spec.rb index 6ccfd39fc7..cd95bc393e 100644 --- a/Library/Homebrew/test/missing_formula_spec.rb +++ b/Library/Homebrew/test/missing_formula_spec.rb @@ -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 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).