Files
metasploit-gs/lib/rex/ui/output.rb
T
Tod Beardsley 1deacad2be Add a print_bad alias for print_error
Came up on Twitter, where Justin may have been trolling a little:

https://twitter.com/jstnkndy/status/798671298302017536

We have a `print_good` method, but not a `print_bad`, which seems a
little weird for Ruby -- opposite methods should be intuitive as Justin
is implying.

Anyway, I went with alias_method, thanks to the compelling argument at

https://github.com/bbatsov/ruby-style-guide#alias-method

...since Metasploit is all about the singleton, and didn't want to risk
some unexpected scoping thing.

Also dang, we define the `print_` methods like fifty billion times!
Really should fix that some day.
2016-11-15 19:20:42 -06:00

85 lines
1.2 KiB
Ruby

# -*- coding: binary -*-
require 'rex/ui'
module Rex
module Ui
###
#
# This class acts as a generic base class for outputing data. It
# only provides stubs for the simplest form of outputing information.
#
###
class Output
# General output
require 'rex/ui/output/none'
# Text-based output
require 'rex/ui/text/output'
#
# Prints an error message.
#
def print_error(msg='')
end
alias_method :print_bad, :print_error
#
# Prints a 'good' message.
#
def print_good(msg='')
end
#
# Prints a status line.
#
def print_status(msg='')
end
#
# Prints an undecorated line of information.
#
def print_line(msg='')
end
#
# Prints a warning
#
def print_warning(msg='')
end
#
# Prints a message with no decoration.
#
def print(msg='')
end
#
# Flushes any buffered output.
#
def flush
end
#
# Called to tell the output medium that we're at a prompt.
# This is used to allow the output medium to display an extra
# carriage return
#
def prompting(v = true)
@at_prompt = v
end
#
# Returns whether or not we're at a prompt currently
#
def prompting?
@at_prompt
end
end
end
end