Clean up some of the UI output

This commit is contained in:
Mitchell Hashimoto 2011-08-10 22:17:37 -07:00
parent 8b1c2fcbe1
commit 3f9a2814c7
2 changed files with 10 additions and 2 deletions

View File

@ -11,9 +11,14 @@ module Vagrant
# Import the virtual machine
env.env.vm.vm = VirtualBox::VM.import(env.env.box.ovf_file.to_s) do |progress|
env.ui.clear_line
env.ui.report_progress(progress.percent, 100, false)
end
# Clear the line one last time since the progress meter doesn't disappear
# immediately.
env.ui.clear_line
# Flag as erroneous and return if import failed
raise Errors::VMImportFailure if !env["vm"].vm

View File

@ -34,7 +34,7 @@ module Vagrant
class_eval <<-CODE
def #{method}(message, opts=nil)
super(message)
@shell.say("\#{line_reset}\#{format_message(message, opts)}", #{color.inspect})
@shell.say("\#{format_message(message, opts)}", #{color.inspect})
end
CODE
end
@ -53,11 +53,14 @@ module Vagrant
percent = (progress.to_f / total.to_f) * 100
line = "Progress: #{percent.to_i}%"
line << " (#{progress} / #{total})" if show_parts
line = "#{line_reset}#{line}"
@shell.say(line, nil, false)
end
def clear_line
@shell.say(line_reset, nil, false)
end
protected
def format_message(message, opts=nil)