Class: Rex::Ui::Text::ProgressTracker

Inherits:
ProgressTracker show all
Defined in:
lib/rex/ui/text/progress_tracker.rb

Overview

This module implements progress tracking against a text interface.

Instance Attribute Summary collapse

Attributes inherited from ProgressTracker

#pos, #start, #stop

Instance Method Summary collapse

Methods inherited from ProgressTracker

#range=, #reset, #step

Constructor Details

#initialize(output) ⇒ ProgressTracker


15
16
17
18
19
20
# File 'lib/rex/ui/text/progress_tracker.rb', line 15

def initialize(output)
  self.output = output
  self.start  = 0
  self.stop   = 0
  self.pos    = 0
end

Instance Attribute Details

#outputObject

Returns the value of attribute output


51
52
53
# File 'lib/rex/ui/text/progress_tracker.rb', line 51

def output
  @output
end

Instance Method Details

#abort(msg = '') ⇒ Object

Progress has been aborted, the reason is supplied in msg.


47
48
49
# File 'lib/rex/ui/text/progress_tracker.rb', line 47

def abort(msg = '')
  output.print_error("fatal: #{msg}")
end

#error(msg = '') ⇒ Object

An error occurred that may result in aborting the progress.


40
41
42
# File 'lib/rex/ui/text/progress_tracker.rb', line 40

def error(msg = '')
  output.print_error(msg)
end

#status(msg = '') ⇒ Object

Passes a generic status message that isn't necessarily associated with a step event.


26
27
28
# File 'lib/rex/ui/text/progress_tracker.rb', line 26

def status(msg = '')
  output.print_status(msg)
end

#step_status(msg = '') ⇒ Object

Updates the status associated with the current step.


33
34
35
# File 'lib/rex/ui/text/progress_tracker.rb', line 33

def step_status(msg = '')
  output.print_status("#{pos}: #{msg}") if (msg and msg.length > 0)
end