From 97aed37aeaab71fe084fa426beb94557316365f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Courtois?= Date: Thu, 1 Aug 2013 13:15:09 -0400 Subject: [PATCH] Use longest machine name to pad in status cmd --- plugins/commands/status/command.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/commands/status/command.rb b/plugins/commands/status/command.rb index 90b7b8584..10a0f7ec4 100644 --- a/plugins/commands/status/command.rb +++ b/plugins/commands/status/command.rb @@ -12,11 +12,16 @@ module VagrantPlugins argv = parse_options(opts) return if !argv + max_name_length = 0 + with_target_vms(argv) do |machine| + max_name_length = machine.name.length if machine.name.length > max_name_length + end + state = nil results = [] with_target_vms(argv) do |machine| state = machine.state if !state - results << "#{machine.name.to_s.ljust(25)} #{machine.state.short_description} (#{machine.provider_name})" + results << "#{machine.name.to_s.ljust(max_name_length)} #{machine.state.short_description} (#{machine.provider_name})" end message = nil