10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/awsutils/ec2listmachines.rb', line 10
def run
servers_sorted = formatted_servers.sort_by { |server| server.fetch(opts[:sort].to_sym, '') }
printf "\033[0m"
items = + servers_sorted.map do |server|
columns.keys.map do |col|
server[col] || ''
end
end.flatten
if opts[:csv]
hl = HighLine::List.new items, cols: columns.count
hl.row_join_string = ','
puts hl.to_s
else
puts HighLine.new.list items, :uneven_columns_across, columns.count
end
end
|