Sha256: 1dbe951b30be6908d31c48ad93ce1140e32e70249d84e7e181b4c0f704b26996

Contents?: true

Size: 982 Bytes

Versions: 15

Compression:

Stored size: 982 Bytes

Contents

# -*- coding: binary -*-
require 'rex/ui/progress_tracker'

module Rex
module Ui
module Text

###
#
# This module implements progress tracking against a text interface.
#
###
class ProgressTracker < Rex::Ui::ProgressTracker

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

  #
  # Passes a generic status message that isn't necessarily associated
  # with a step event.
  #
  def status(msg = '')
    output.print_status(msg)
  end

  #
  # Updates the status associated with the current step.
  #
  def step_status(msg = '')
    output.print_status("#{pos}: #{msg}") if (msg and msg.length > 0)
  end

  #
  # An error occurred that may result in aborting the progress.
  #
  def error(msg = '')
    output.print_error(msg)
  end

  #
  # Progress has been aborted, the reason is supplied in msg.
  #
  def abort(msg = '')
    output.print_error("fatal: #{msg}")
  end

  attr_accessor :output

end

end
end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
rex-2.0.13 lib/rex/ui/text/progress_tracker.rb
rex-2.0.12 lib/rex/ui/text/progress_tracker.rb
rex-2.0.11 lib/rex/ui/text/progress_tracker.rb
rex-2.0.10 lib/rex/ui/text/progress_tracker.rb
rex-2.0.9 lib/rex/ui/text/progress_tracker.rb
rex-2.0.8 lib/rex/ui/text/progress_tracker.rb
rex-2.0.7 lib/rex/ui/text/progress_tracker.rb
rex-2.0.5 lib/rex/ui/text/progress_tracker.rb
rex-2.0.4 lib/rex/ui/text/progress_tracker.rb
dstruct-0.0.1 lib/rex/ui/text/progress_tracker.rb
rex-2.0.3 lib/rex/ui/text/progress_tracker.rb
librex-0.0.999 lib/rex/ui/text/progress_tracker.rb
rex-2.0.2 lib/rex/ui/text/progress_tracker.rb
librex-0.0.71 lib/rex/ui/text/progress_tracker.rb
librex-0.0.70 lib/rex/ui/text/progress_tracker.rb