Method: Cow::Application#cmd_list

Defined in:
lib/cow/application.rb

#cmd_list(_hostname) ⇒ Object



205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/cow/application.rb', line 205

def cmd_list(_hostname)
  load_cache
  puts '%s %s %s' % ['SERVER/PORT'.ljust(30), 'PORTNAME'.ljust(20), 'COMMAND']

  @cache.servers.each do |server|
    if _hostname.nil? || server.hostname == _hostname
      server.ports.each do |port|
        puts '%s %s %s' % ["#{server.hostname}/#{port.port}".ljust(30), port.name.to_s.ljust(20), server.connect_command(port)]
      end
    end
  end
end