module Rufo::Command
def self.format_stdin(want_check)
def self.format_stdin(want_check) code = STDIN.read result = format(code, Dir.getwd) if want_check exit 1 if result != code else print result end rescue Rufo::SyntaxError STDERR.puts "Error: the given text is not a valid ruby program (it has syntax errors)" exit 1 rescue Rufo::Bug => ex STDERR.puts "You've found a bug!" STDERR.puts "Please report it to https://github.com/asterite/rufo/issues with code that triggers it" STDERR.puts raise ex end