From 69c076e741f1403add500c6c0fd618522aa8d79e Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 8 Aug 2009 14:05:09 +0100 Subject: [PATCH] ohai takes multiple parameters Will not show any of the block if the 1st additional parameter is nil --- Library/Homebrew/utils.rb | 8 +++++++- bin/brew | 6 +----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index bb64c38519..7c86faf1b7 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -15,9 +15,15 @@ # You should have received a copy of the GNU General Public License # along with Homebrew. If not, see . -def ohai title +# args are additional inputs to puts until a nil arg is encountered +def ohai title, *args + return if args.length > 0 and args[0].nil? n=`tput cols`.strip.to_i-4 puts "\033[0;34m==>\033[0;0;1m #{title[0,n]}\033[0;0m" + args.each do |arg| + return if arg.nil? + puts arg + end end # shows a warning in delicious pink diff --git a/bin/brew b/bin/brew index d4162986ab..5452838446 100755 --- a/bin/brew +++ b/bin/brew @@ -58,11 +58,7 @@ begin start_time=Time.now begin install f - if f.caveats - ohai "Caveats" - puts f.caveats - puts - end + ohai "Caveats", f.caveats, '' ohai 'Finishing up' clean f raise "Nothing was installed to #{f.prefix}" unless f.installed?