lib/cloudstack-cli/commands/network.rb in cloudstack-cli-0.1.2 vs lib/cloudstack-cli/commands/network.rb in cloudstack-cli-0.1.3

- old
+ new

@@ -5,34 +5,37 @@ # TODO end desc "list", "list networks" option :project - option :account, default: "" + option :account + option :showid, type: :boolean def list project = find_project if options[:project] - networks = [] if project networks = client.list_networks(project['id']) + elsif options[:account] + networks = client.list_networks(account: options[:account]) else - networks = client.list_networks(-1, options[:account] != '' ? options[:account] : nil ) - networks + client.list_networks(nil, options[:account] != '' ? options[:account] : nil ) + networks = client.list_networks(project_id: -1) end if networks.size < 1 puts "No networks found" else - table = [["Name", "Displaytext", "Account", "Project", "State", "ID"]] + table = [["Name", "Displaytext", "Account", "Project", "Domain", "State"]] + table[0] << "ID" if options[:showid] networks.each do |network| table << [ network["name"], network["displaytext"], network["account"], network["project"], - network["state"], - network["id"] + network["domain"], + network["state"] ] + table[-1] << network["id"] if options[:showid] end print_table table end end \ No newline at end of file