Sha256: 6adc4bfffa38156c58091465118a90453e6092a0bad63e7ca0c0a431c2355d70

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

require 'rex/ui'

begin
	require 'windows_console_color_support'
rescue ::LoadError
end

module Rex
module Ui
module Text

###
#
# This class implements output against standard out.
#
###
class Output::Stdio < Rex::Ui::Text::Output

	def supports_color?
		case config[:color]
		when true
			return true
		when false
			return false
		else # auto
			if (Rex::Compat.is_windows)
				return true
			end
			term = Rex::Compat.getenv('TERM')
			return (term and term.match(/(?:vt10[03]|xterm(?:-color)?|linux|screen|rxvt)/i) != nil)
		end
	end

	#
	# Prints the supplied message to standard output.
	#
	def print_raw(msg = '')
		if (Rex::Compat.is_windows and supports_color?)
			WindowsConsoleColorSupport.new($stdout).write(msg)
		else
			$stdout.print(msg)
		end
		$stdout.flush

		msg
	end
end

end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
librex-0.0.65 lib/rex/ui/text/output/stdio.rb