Commit 9fb296b5 authored by Fabio Pelosin's avatar Fabio Pelosin

[UI] Fix output color & warning crash

parent bcb2d607
......@@ -52,11 +52,18 @@ module Pod
#
# @todo We should probably not even load colored unless needed.
#
# @todo Move silent flag to CLAide.
#
# @note It is importat that the commadnds don't overide the default
# settings if their flag is missing (i.e. their value is nil)
#
def initialize(argv)
config.silent = argv.flag?('silent', config.silent)
config.verbose = argv.flag?('verbose', config.verbose?)
String.send(:define_method, :colorize) { |string , _| string } unless self.colorize_output?
super
config.silent = argv.flag?('silent', config.silent)
config.verbose = self.verbose? unless self.verbose.nil?
unless self.colorize_output?
String.send(:define_method, :colorize) { |string , _| string }
end
end
#-------------------------------------------------------------------------#
......
......@@ -145,7 +145,7 @@ module Pod
# return [void]
#
def warn(message, actions = [], verbose_only = false)
warnings << { :message => message, :actions => actions }
warnings << { :message => message, :actions => actions, :verbose_only => verbose_only }
end
# Prints the stored warnings. This method is intended to be called at the
......@@ -154,9 +154,9 @@ module Pod
# @return [void]
#
def print_warnings
return if config.silent? && verbose_only
STDOUT.flush
warnings.each do |warning|
next if warning[:verbose_only] && !config.verbose?
STDERR.puts("\n[!] #{warning[:message]}".yellow)
warning[:actions].each do |action|
indented = wrap_string(action, " - ")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment