Use longest machine name to pad in status cmd

This commit is contained in:
Marc-André Courtois 2013-08-01 13:15:09 -04:00
parent 16002d03c0
commit 97aed37aea
1 changed files with 6 additions and 1 deletions

View File

@ -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