module Console::Output

def self.new(output = nil, env = ENV, **options)

@returns [Console::Output] The output instance.
@parameter options [Hash] Additional options to customize the output.
@parameter env [Hash] The environment to read configuration from.
@parameter output [Console::Output] The output to wrap OR an IO object.

The output argument is deliberately unders-specified but can be an IO object or an instance of {Output}.

The environment variable `CONSOLE_OUTPUT` can be used to specify a list of output classes to wrap around the output. If not specified the {Default} output is used.

Create a new output based on the environment.
def self.new(output = nil, env = ENV, **options)
	if names = env["CONSOLE_OUTPUT"]
		names = names.split(",").reverse
		
		names.inject(output) do |output, name|
			Output.const_get(name).new(output, **options)
		end
	else
		return Output::Default.new(output, **options)
	end
end