From 53932185e66d4764ecbed041cb3c21e099087299 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Thu, 13 Aug 2020 22:14:52 +0100 Subject: [PATCH] Show cask description as None if not present --- Library/Homebrew/cask/cmd/info.rb | 7 ++----- Library/Homebrew/test/cask/cmd/info_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/cmd/info.rb b/Library/Homebrew/cask/cmd/info.rb index 0b60974bae..5d5e236000 100644 --- a/Library/Homebrew/cask/cmd/info.rb +++ b/Library/Homebrew/cask/cmd/info.rb @@ -36,8 +36,7 @@ module Cask repo = repo_info(cask) output << repo + "\n" if repo output << name_info(cask) - description = desc_info(cask) - output << description if description + output << desc_info(cask) language = language_info(cask) output << language if language output << artifact_info(cask) + "\n" @@ -85,11 +84,9 @@ module Cask end def self.desc_info(cask) - return if cask.desc.nil? - <<~EOS #{ohai_title("Description")} - #{cask.desc} + #{cask.desc.nil? ? Formatter.error("None") : cask.desc} EOS end diff --git a/Library/Homebrew/test/cask/cmd/info_spec.rb b/Library/Homebrew/test/cask/cmd/info_spec.rb index d21c62e7c4..3828d4d95e 100644 --- a/Library/Homebrew/test/cask/cmd/info_spec.rb +++ b/Library/Homebrew/test/cask/cmd/info_spec.rb @@ -35,6 +35,8 @@ describe Cask::Cmd::Info, :cask do From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-auto-updates.rb ==> Name AutoUpdates + ==> Description + None ==> Artifacts AutoUpdates.app (App) EOS @@ -49,6 +51,8 @@ describe Cask::Cmd::Info, :cask do From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/local-caffeine.rb ==> Name None + ==> Description + None ==> Artifacts Caffeine.app (App) @@ -82,6 +86,8 @@ describe Cask::Cmd::Info, :cask do From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-caveats.rb ==> Name None + ==> Description + None ==> Artifacts Caffeine.app (App) ==> Caveats @@ -107,6 +113,8 @@ describe Cask::Cmd::Info, :cask do From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-conditional-caveats.rb ==> Name None + ==> Description + None ==> Artifacts Caffeine.app (App) EOS @@ -122,6 +130,8 @@ describe Cask::Cmd::Info, :cask do From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/with-languages.rb ==> Name None + ==> Description + None ==> Languages zh, en-US ==> Artifacts @@ -139,6 +149,8 @@ describe Cask::Cmd::Info, :cask do From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/without-languages.rb ==> Name None + ==> Description + None ==> Artifacts Caffeine.app (App) EOS @@ -167,6 +179,8 @@ describe Cask::Cmd::Info, :cask do ==> Names Docker Community Edition Docker CE + ==> Description + None ==> Artifacts Docker.app (App) ==> Analytics @@ -178,6 +192,8 @@ describe Cask::Cmd::Info, :cask do ==> Names Docker Community Edition Docker CE + ==> Description + None ==> Artifacts Docker.app (App) ==> Analytics