lib/spoom/cli/run.rb in spoom-1.0.8 vs lib/spoom/cli/run.rb in spoom-1.0.9
- old
+ new
@@ -34,17 +34,17 @@
count = options[:count]
sorbet = options[:sorbet]
unless limit || code || sort
output, status = T.unsafe(Spoom::Sorbet).srb_tc(*arg, path: path, capture_err: false, sorbet_bin: sorbet)
- $stderr.print(output)
+ say_error(output, status: nil, nl: false)
exit(status)
end
output, status = T.unsafe(Spoom::Sorbet).srb_tc(*arg, path: path, capture_err: true, sorbet_bin: sorbet)
if status
- $stderr.print(output)
+ say_error(output, status: nil, nl: false)
exit(0)
end
errors = Spoom::Sorbet::Errors::Parser.parse_string(output)
errors_count = errors.size
@@ -63,27 +63,27 @@
lines = errors.map { |e| format_error(e, format || DEFAULT_FORMAT) }
lines = lines.uniq if uniq
lines.each do |line|
- $stderr.puts line
+ say_error(line, status: nil)
end
if count
if errors_count == errors.size
- $stderr.puts "Errors: #{errors_count}"
+ say_error("Errors: #{errors_count}", status: nil)
else
- $stderr.puts "Errors: #{errors.size} shown, #{errors_count} total"
+ say_error("Errors: #{errors.size} shown, #{errors_count} total", status: nil)
end
end
exit(1)
end
no_commands do
def format_error(error, format)
line = format
- line = line.gsub(/%C/, colorize(error.code.to_s, :yellow))
+ line = line.gsub(/%C/, yellow(error.code.to_s))
line = line.gsub(/%F/, error.file)
line = line.gsub(/%L/, error.line.to_s)
line = line.gsub(/%M/, colorize_message(error.message))
line
end