lib/thor/shell/basic.rb in thor-0.13.8 vs lib/thor/shell/basic.rb in thor-0.14.0
- old
+ new
@@ -33,17 +33,19 @@
#
# ==== Example
# say("I know you knew that.")
#
def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)$/))
- message = message.to_s
- message = set_color(message, color) if color
+ message = message.to_s
+ message = set_color(message, color) if color
+ spaces = " " * padding
+
if force_new_line
- $stdout.puts(message)
+ $stdout.puts(spaces + message)
else
- $stdout.print(message)
+ $stdout.print(spaces + message)
end
$stdout.flush
end
# Say a status with the given color and appends the message. Since this
@@ -56,10 +58,12 @@
spaces = " " * (padding + 1)
color = log_status.is_a?(Symbol) ? log_status : :green
status = status.to_s.rjust(12)
status = set_color status, color, true if color
- say "#{status}#{spaces}#{message}", nil, true
+
+ $stdout.puts "#{status}#{spaces}#{message}"
+ $stdout.flush
end
# Make a question the to user and returns true if the user replies "y" or
# "yes".
#