aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/log.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-28 01:40:20 -0800
committerelijah <elijah@riseup.net>2012-11-28 01:40:20 -0800
commitc76221182ca98ed804cc0c5259982250fa45f67c (patch)
treecdc3385f04eadc793274c4943e21fe419b406ccb /lib/leap_cli/log.rb
parentc91b94d10ae5540c5d4128f8ca8748bd897f2cfb (diff)
downloadleap_cli-c76221182ca98ed804cc0c5259982250fa45f67c.tar.gz
leap_cli-c76221182ca98ed804cc0c5259982250fa45f67c.tar.bz2
give the user a nice error if 'init-node' has not yet been run (or if there are required packages that are missing).
Diffstat (limited to 'lib/leap_cli/log.rb')
-rw-r--r--lib/leap_cli/log.rb40
1 files changed, 23 insertions, 17 deletions
diff --git a/lib/leap_cli/log.rb b/lib/leap_cli/log.rb
index 42a886e..4b0bbe2 100644
--- a/lib/leap_cli/log.rb
+++ b/lib/leap_cli/log.rb
@@ -59,27 +59,33 @@ module LeapCli
end
if title
prefix = case title
- when :error then Paint['error', :red, :bold]
- when :warning then Paint['warning', :yellow, :bold]
- when :info then Paint['info', :cyan, :bold]
- when :updated then Paint['updated', :cyan, :bold]
- when :updating then Paint['updating', :cyan, :bold]
- when :created then Paint['created', :green, :bold]
- when :removed then Paint['removed', :red, :bold]
- when :nochange then Paint['no change', :magenta]
- when :loading then Paint['loading', :magenta]
- when :missing then Paint['missing', :yellow, :bold]
- when :run then Paint['run', :magenta]
- when :failed then Paint['FAILED', :red, :bold]
- when :completed then Paint['completed', :green, :bold]
- when :ran then Paint['ran', :green, :bold]
- when :bail then Paint['bailing out', :red, :bold]
- else Paint[title.to_s, :cyan, :bold]
+ when :error then ['error', :red, :bold]
+ when :warning then ['warning', :yellow, :bold]
+ when :info then ['info', :cyan, :bold]
+ when :updated then ['updated', :cyan, :bold]
+ when :updating then ['updating', :cyan, :bold]
+ when :created then ['created', :green, :bold]
+ when :removed then ['removed', :red, :bold]
+ when :nochange then ['no change', :magenta]
+ when :loading then ['loading', :magenta]
+ when :missing then ['missing', :yellow, :bold]
+ when :run then ['run', :magenta]
+ when :failed then ['FAILED', :red, :bold]
+ when :completed then ['completed', :green, :bold]
+ when :ran then ['ran', :green, :bold]
+ when :bail then ['bailing out', :red, :bold]
+ else [title.to_s, :cyan, :bold]
+ end
+ if options[:host]
+ print "[%s] %s " % [Paint[options[:host], prefix[1], prefix[2]], prefix[0]]
+ else
+ print "%s " % Paint[prefix[0], prefix[1], prefix[2]]
end
- print "#{prefix} "
if FILE_TITLES.include?(title) && message =~ /^\//
message = LeapCli::Path.relative_path(message)
end
+ elsif options[:host]
+ print "[%s] " % options[:host]
end
puts "#{message}"
if block_given?