#!/usr/bin/env ruby $:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) require "poolparty" o = PoolParty::Optioner.new(ARGV) do |opts, optioner| opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c } end o.loaded_clouds.each do |cld| print_with_nice_printer "Cloud: #{cld.name}", [ "instances #{cld.minimum_instances}..#{cld.maximum_instances}", "keypair #{cld.keypair}" ] do |printer| if cld.list_of_running_instances.size > 0 printer.empty printer.center("Active instances") printer << cld.list_of_running_instances.map{|a| a.ip.strip }.join("\n") end if cld.list_of_pending_instances.size > 0 printer.empty printer.center "Pending instances" printer << cld.list_of_pending_instances.map{|a| a.to_s}.join("\n") end printer.empty end end