Module: Tapioca::CliHelper

Extended by:
T::Helpers, T::Sig
Included in:
Cli, Generators::Base
Defined in:
lib/tapioca/helpers/cli_helper.rb

Instance Method Summary collapse

Instance Method Details

#say_error(message = "", *color) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tapioca/helpers/cli_helper.rb', line 14

def say_error(message = "", *color)
  force_new_line = (message.to_s !~ /( |\t)\Z/)
  # NOTE: This is a hack. We're no longer subclassing from Thor::Shell::Color
  # so we no longer have access to the prepare_message call.
  # We should update this to remove this.
  buffer = shell.send(:prepare_message, *T.unsafe([message, *T.unsafe(color)]))
  buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")

  $stderr.print(buffer)
  $stderr.flush
end