lib/linecook/commands/state.rb in linecook-1.1.0 vs lib/linecook/commands/state.rb in linecook-1.2.0

- old
+ new

@@ -10,17 +10,17 @@ # class State < VboxCommand config :hosts, false, :short => :n, &c.flag # print state by host def state(vm_name) - running?(vm_name) ? "running" : "stopped" + `VBoxManage showvminfo #{vm_name}` =~ /^State:\s+(.*)$/ ? $1 : 'unknown' end def process(*hosts) vm_names = resolve_vm_names(hosts) if hosts each_host(vm_names) do |host| - puts "#{host}: #{state(host_map[host])}" + puts "#{host}: #{state(host_map[host] || host)}" end else each_vm_name(vm_names) do |vm_name| puts "#{vm_name}: #{state(vm_name)}" end \ No newline at end of file