Method: Bundler::Thor::Shell::Basic#say_error

Defined in:
lib/bundler/vendor/thor/lib/thor/shell/basic.rb

#say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/)) ⇒ Object

Say (print) an error to the user. If the sentence ends with a whitespace or tab character, a new line is not appended (print + flush). Otherwise are passed straight to puts (behavior got from Highline).

Example

say_error("error: something went wrong")


115
116
117
118
119
120
121
122
123
# File 'lib/bundler/vendor/thor/lib/thor/shell/basic.rb', line 115

def say_error(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")

  stderr.print(buffer)
  stderr.flush
end