module Console::Output::Default

def self.new(stream, env: ENV, **options)

@returns [Console::Output::Terminal | Console::Output::Serialized] The output instance, depending on whether the `io` is a terminal or not.
@parameter options [Hash] Additional options to customize the output.
@parameter env [Hash] Environment variables (defaults to ENV for testing).
@parameter io [IO] The output stream.

Create a new output format based on the given stream.
def self.new(stream, env: ENV, **options)
	stream ||= $stderr
	
	if stream.tty? || mail?(env)
		output = Terminal.new(stream, **options)
	else
		output = Serialized.new(stream, **options)
	end
	
	return output
end