Merge pull request #13693 from FnControlHomebrew/info
info: highlight package name
This commit is contained in:
		
						commit
						c7df26fed2
					
				@ -79,7 +79,7 @@ module Cask
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def self.title_info(cask)
 | 
					      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 += " (auto_updates)" if cask.auto_updates
 | 
				
			||||||
        title
 | 
					        title
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
				
			|||||||
@ -274,7 +274,7 @@ module Homebrew
 | 
				
			|||||||
    attrs << "pinned at #{f.pinned_version}" if f.pinned?
 | 
					    attrs << "pinned at #{f.pinned_version}" if f.pinned?
 | 
				
			||||||
    attrs << "keg-only" if f.keg_only?
 | 
					    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 f.desc if f.desc
 | 
				
			||||||
    puts Formatter.url(f.homepage) if f.homepage
 | 
					    puts Formatter.url(f.homepage) if f.homepage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ describe Cask::Cmd::Info, :cask do
 | 
				
			|||||||
    expect {
 | 
					    expect {
 | 
				
			||||||
      described_class.run("local-transmission")
 | 
					      described_class.run("local-transmission")
 | 
				
			||||||
    }.to output(<<~EOS).to_stdout
 | 
					    }.to output(<<~EOS).to_stdout
 | 
				
			||||||
      local-transmission: 2.61
 | 
					      ==> local-transmission: 2.61
 | 
				
			||||||
      https://transmissionbt.com/
 | 
					      https://transmissionbt.com/
 | 
				
			||||||
      Not installed
 | 
					      Not installed
 | 
				
			||||||
      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb
 | 
					      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb
 | 
				
			||||||
@ -25,7 +25,7 @@ describe Cask::Cmd::Info, :cask do
 | 
				
			|||||||
    expect {
 | 
					    expect {
 | 
				
			||||||
      described_class.run("with-auto-updates")
 | 
					      described_class.run("with-auto-updates")
 | 
				
			||||||
    }.to output(<<~EOS).to_stdout
 | 
					    }.to output(<<~EOS).to_stdout
 | 
				
			||||||
      with-auto-updates: 1.0 (auto_updates)
 | 
					      ==> with-auto-updates: 1.0 (auto_updates)
 | 
				
			||||||
      https://brew.sh/autoupdates
 | 
					      https://brew.sh/autoupdates
 | 
				
			||||||
      Not installed
 | 
					      Not installed
 | 
				
			||||||
      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-auto-updates.rb
 | 
					      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
 | 
					  describe "given multiple Casks" do
 | 
				
			||||||
    let(:expected_output) {
 | 
					    let(:expected_output) {
 | 
				
			||||||
      <<~EOS
 | 
					      <<~EOS
 | 
				
			||||||
        local-caffeine: 1.2.3
 | 
					        ==> local-caffeine: 1.2.3
 | 
				
			||||||
        https://brew.sh/
 | 
					        https://brew.sh/
 | 
				
			||||||
        Not installed
 | 
					        Not installed
 | 
				
			||||||
        From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-caffeine.rb
 | 
					        From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-caffeine.rb
 | 
				
			||||||
@ -52,7 +52,7 @@ describe Cask::Cmd::Info, :cask do
 | 
				
			|||||||
        ==> Artifacts
 | 
					        ==> Artifacts
 | 
				
			||||||
        Caffeine.app (App)
 | 
					        Caffeine.app (App)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        local-transmission: 2.61
 | 
					        ==> local-transmission: 2.61
 | 
				
			||||||
        https://transmissionbt.com/
 | 
					        https://transmissionbt.com/
 | 
				
			||||||
        Not installed
 | 
					        Not installed
 | 
				
			||||||
        From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb
 | 
					        From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-transmission.rb
 | 
				
			||||||
@ -76,7 +76,7 @@ describe Cask::Cmd::Info, :cask do
 | 
				
			|||||||
    expect {
 | 
					    expect {
 | 
				
			||||||
      described_class.run("with-caveats")
 | 
					      described_class.run("with-caveats")
 | 
				
			||||||
    }.to output(<<~EOS).to_stdout
 | 
					    }.to output(<<~EOS).to_stdout
 | 
				
			||||||
      with-caveats: 1.2.3
 | 
					      ==> with-caveats: 1.2.3
 | 
				
			||||||
      https://brew.sh/
 | 
					      https://brew.sh/
 | 
				
			||||||
      Not installed
 | 
					      Not installed
 | 
				
			||||||
      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-caveats.rb
 | 
					      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-caveats.rb
 | 
				
			||||||
@ -103,7 +103,7 @@ describe Cask::Cmd::Info, :cask do
 | 
				
			|||||||
    expect {
 | 
					    expect {
 | 
				
			||||||
      described_class.run("with-conditional-caveats")
 | 
					      described_class.run("with-conditional-caveats")
 | 
				
			||||||
    }.to output(<<~EOS).to_stdout
 | 
					    }.to output(<<~EOS).to_stdout
 | 
				
			||||||
      with-conditional-caveats: 1.2.3
 | 
					      ==> with-conditional-caveats: 1.2.3
 | 
				
			||||||
      https://brew.sh/
 | 
					      https://brew.sh/
 | 
				
			||||||
      Not installed
 | 
					      Not installed
 | 
				
			||||||
      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-conditional-caveats.rb
 | 
					      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 {
 | 
					    expect {
 | 
				
			||||||
      described_class.run("with-languages")
 | 
					      described_class.run("with-languages")
 | 
				
			||||||
    }.to output(<<~EOS).to_stdout
 | 
					    }.to output(<<~EOS).to_stdout
 | 
				
			||||||
      with-languages: 1.2.3
 | 
					      ==> with-languages: 1.2.3
 | 
				
			||||||
      https://brew.sh/
 | 
					      https://brew.sh/
 | 
				
			||||||
      Not installed
 | 
					      Not installed
 | 
				
			||||||
      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-languages.rb
 | 
					      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-languages.rb
 | 
				
			||||||
@ -139,7 +139,7 @@ describe Cask::Cmd::Info, :cask do
 | 
				
			|||||||
    expect {
 | 
					    expect {
 | 
				
			||||||
      described_class.run("without-languages")
 | 
					      described_class.run("without-languages")
 | 
				
			||||||
    }.to output(<<~EOS).to_stdout
 | 
					    }.to output(<<~EOS).to_stdout
 | 
				
			||||||
      without-languages: 1.2.3
 | 
					      ==> without-languages: 1.2.3
 | 
				
			||||||
      https://brew.sh/
 | 
					      https://brew.sh/
 | 
				
			||||||
      Not installed
 | 
					      Not installed
 | 
				
			||||||
      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/without-languages.rb
 | 
					      From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/without-languages.rb
 | 
				
			||||||
 | 
				
			|||||||
@ -103,7 +103,7 @@ describe Homebrew::MissingFormula do
 | 
				
			|||||||
      let(:formula) { "local-caffeine" }
 | 
					      let(:formula) { "local-caffeine" }
 | 
				
			||||||
      let(:show_info) { true }
 | 
					      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
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context "with a formula name that is not a cask" do
 | 
					    context "with a formula name that is not a cask" do
 | 
				
			||||||
 | 
				
			|||||||
@ -125,7 +125,7 @@ module Kernel
 | 
				
			|||||||
    puts sput unless sput.empty?
 | 
					    puts sput unless sput.empty?
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def oh1(title, truncate: :auto)
 | 
					  def oh1_title(title, truncate: :auto)
 | 
				
			||||||
    verbose = if respond_to?(:verbose?)
 | 
					    verbose = if respond_to?(:verbose?)
 | 
				
			||||||
      verbose?
 | 
					      verbose?
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
@ -133,7 +133,11 @@ module Kernel
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    title = Tty.truncate(title) if $stdout.tty? && !verbose && truncate == :auto
 | 
					    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
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Print a message prefixed with "Warning" (do this rarely).
 | 
					  # Print a message prefixed with "Warning" (do this rarely).
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user