Sha256: 50097f1fff47033668c01af45d37df22c7ca7dfa3e20ac184cd3305b3e1403b4

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 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

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/ui/text/progress_tracker.rb
librex-0.0.66 lib/rex/ui/text/progress_tracker.rb