From 6386ec2b797ce171a7c080013151119d7fa4d3d4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 9 Jul 2012 18:37:38 -0700 Subject: [PATCH] `vagrant box list` uses the new collection stuff --- plugins/commands/box/command/list.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/commands/box/command/list.rb b/plugins/commands/box/command/list.rb index 885952493..28e2a8c0d 100644 --- a/plugins/commands/box/command/list.rb +++ b/plugins/commands/box/command/list.rb @@ -15,11 +15,22 @@ module VagrantPlugins argv = parse_options(opts) return if !argv - boxes = @env.boxes.sort + boxes = @env.boxes.all.sort if boxes.empty? return @env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :prefix => false) end - boxes.each { |b| @env.ui.info(b.name, :prefix => false) } + + # Find the longest box name + longest_box = boxes.max_by { |x| x[0].length } + longest_box_length = longest_box[0].length + + # Go through each box and output the information about it. We + # ignore the "v1" param for now since I'm not yet sure if its + # important for the user to know what boxes need to be upgraded + # and which don't, since we plan on doing that transparently. + boxes.each do |name, provider, _v1| + @env.ui.info("#{name.ljust(longest_box_length)} (#{provider})", :prefix => false) + end # Success, exit status 0 0