From 5de3686cd2e041dae893f9e84d74c925cb6c85f5 Mon Sep 17 00:00:00 2001 From: Frizlab Date: Sat, 25 Jan 2014 06:30:46 +0100 Subject: [PATCH] upgrade: fix output when no packages to upgrade. When upgrading, if the only package to upgrade is a pinned package, the output looked like that: ==> Upgrading 0 packages, with result: ==> Not upgrading 1 pinned package: <> The blank line is not beautiful. This commit fixes the output and replaces with: ==> No packages to upgrade ==> Not upgrading 1 pinned package: <> Closes Homebrew/homebrew#26157. Signed-off-by: Mike McQuaid --- Library/Homebrew/cmd/upgrade.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index ed3529e985..a68830a94b 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -34,8 +34,12 @@ module Homebrew extend self outdated -= pinned end - oh1 "Upgrading #{outdated.length} outdated package#{outdated.length.plural_s}, with result:" - puts outdated.map{ |f| "#{f.name} #{f.version}" } * ", " + unless outdated.empty? + oh1 "Upgrading #{outdated.length} outdated package#{outdated.length.plural_s}, with result:" + puts outdated.map{ |f| "#{f.name} #{f.version}" } * ", " + else + oh1 "No packages to upgrade" + end unless upgrade_pinned? || pinned.empty? oh1 "Not upgrading #{pinned.length} pinned package#{pinned.length.plural_s}:"