class Console::Terminal::Formatter::Progress

def format(event, stream, verbose: false, width: 80)

@parameter width [Integer] The width of the progress bar.
@parameter verbose [Boolean] Whether to include additional information.
@parameter stream [IO] The stream to write the formatted event to.
@parameter event [Hash] The event to format.

Format the given event.
def format(event, stream, verbose: false, width: 80)
	current = event[:current].to_f
	total = event[:total].to_f
	value = current / total
	
	# Clamp value to 1.0 to avoid rendering issues:
	if value > 1.0
		value = 1.0
	end
	
	stream.puts "#{@terminal[:progress_bar]}#{self.bar(value, width-10)}#{@terminal.reset} #{sprintf('%6.2f', value * 100)}%"
end