On import/export, hide "parts" of progress (since its simply out of 100)

This commit is contained in:
Mitchell Hashimoto 2010-04-12 18:11:32 -07:00
parent f8dee9adf9
commit d5e2a64fd3
3 changed files with 5 additions and 4 deletions

View File

@ -36,7 +36,7 @@ module Vagrant
def export
logger.info "Exporting VM to #{ovf_path}..."
@runner.vm.export(ovf_path) do |progress|
update_progress(progress, 100)
update_progress(progress, 100, false)
end
complete_progress

View File

@ -10,7 +10,7 @@ module Vagrant
logger.info "Importing base VM (#{@runner.env.box.ovf_file})..."
# Use the first argument passed to the action
@runner.vm = VirtualBox::VM.import(@runner.env.box.ovf_file) do |progress|
update_progress(progress, 100)
update_progress(progress, 100, false)
end
complete_progress

View File

@ -13,9 +13,10 @@ module Vagrant
#
# @param [Float] progress Progress
# @param [Float] total Total
def update_progress(progress, total)
def update_progress(progress, total, show_parts=true)
percent = (progress.to_f / total.to_f) * 100
print "#{CL_RESET}Progress: #{percent.to_i}% (#{progress} / #{total})"
print "#{CL_RESET}Progress: #{percent.to_i}%"
print " (#{progress} / #{total})" if show_parts
$stdout.flush
end