bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb in rubygems-update-3.2.7 vs bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb in rubygems-update-3.2.8
- old
+ new
@@ -92,10 +92,12 @@
#
# ==== Example
# say("I know you knew that.")
#
def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
+ return if quiet?
+
buffer = prepare_message(message, *color)
buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")
stdout.print(buffer)
stdout.flush
@@ -228,11 +230,12 @@
indent = options[:indent] || 0
width = terminal_width - indent
paras = message.split("\n\n")
paras.map! do |unwrapped|
- counter = 0
- unwrapped.split(" ").inject do |memo, word|
+ words = unwrapped.split(" ")
+ counter = words.first.length
+ words.inject do |memo, word|
word = word.gsub(/\n\005/, "\n").gsub(/\005/, "\n")
counter = 0 if word.include? "\n"
if (counter + word.length + 1) < width
memo = "#{memo} #{word}"
counter += (word.length + 1)