From cbc7e7eedb4dec3ca71f1ab8bea7725b312f265c Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Fri, 4 Oct 2013 22:08:39 -0300 Subject: [PATCH] commands/box: Preparing to display additional box information on `box list` --- plugins/commands/box/command/list.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/commands/box/command/list.rb b/plugins/commands/box/command/list.rb index 94a4d3964..2eb4e0790 100644 --- a/plugins/commands/box/command/list.rb +++ b/plugins/commands/box/command/list.rb @@ -24,12 +24,20 @@ module VagrantPlugins longest_box = boxes.max_by { |x| x[0].length } longest_box_length = longest_box[0].length + # Find the longest provider name + longest_provider = boxes.max_by { |x| x[1].length } + longest_provider_length = longest_provider[1].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) + name = name.ljust(longest_box_length) + provider = "(#{provider})".ljust(longest_provider_length + 2) # 2 -> parenthesis + box_info = "#{name} #{provider}" + + @env.ui.info(box_info, :prefix => false) end # Success, exit status 0