Adding machine-readable output to global-status

This commit is contained in:
Greg J Preece 2019-05-29 10:48:38 -07:00
parent a6f0d24f68
commit c6a6fd34a3
1 changed files with 11 additions and 0 deletions

View File

@ -65,6 +65,17 @@ module VagrantPlugins
@env.machine_index.delete(deletable) if deletable
end
# Machine-readable (non-formatted) output
@env.ui.machine("metadata", "machine-count", entries.length.to_s);
entries.each do |entry|
opts = { "target" => entry.send(:name).to_s }
@env.ui.machine("machine-id", entry.send(:id).to_s, opts)
@env.ui.machine("provider-name", entry.send(:provider).to_s, opts)
@env.ui.machine("machine-home", entry.send(:vagrantfile_path).to_s, opts)
@env.ui.machine("state", entry.send(:state).to_s, opts)
end
# Human-readable (table formatted) output
total_width = 0
columns.each do |header, method|
header = header.ljust(widths[method]) if widths[method]