Class: Rex::Ui::Text::Output::Stdio
- Inherits:
-
Rex::Ui::Text::Output
- Object
- Output
- Rex::Ui::Text::Output
- Rex::Ui::Text::Output::Stdio
- Defined in:
- lib/rex/ui/text/output/stdio.rb
Overview
This class implements output against standard out.
Constant Summary
Constants included from Color
Instance Attribute Summary
Attributes inherited from Rex::Ui::Text::Output
Instance Method Summary collapse
-
#print_raw(msg = '') ⇒ Object
Prints the supplied message to standard output.
- #supports_color? ⇒ Boolean
Methods inherited from Rex::Ui::Text::Output
#auto_color, #disable_color, #enable_color, #initialize, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #print_warning, #reset, #update_prompt
Methods included from Color
#ansi, #colorize, #do_colorize, #reset_color, #substitute_colors
Methods inherited from Output
#flush, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #print_warning, #prompting, #prompting?
Constructor Details
This class inherits a constructor from Rex::Ui::Text::Output
Instance Method Details
#print_raw(msg = '') ⇒ Object
Prints the supplied message to standard output.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rex/ui/text/output/stdio.rb', line 38 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 |
#supports_color? ⇒ Boolean
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rex/ui/text/output/stdio.rb', line 20 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 |