class Thor::Shell::Basic
def print_table(table, options={})
ident
==== Options
Array[Array[String, String, ...]]
==== Parameters
Prints a table.
def print_table(table, options={}) return if table.empty? formats = [] 0.upto(table.first.length - 2) do |i| maxima = table.max{ |a,b| a[i].size <=> b[i].size }[i].size formats << "%-#{maxima + 2}s" end formats[0] = formats[0].insert(0, " " * options[:ident]) if options[:ident] formats << "%s" table.each do |row| row.each_with_index do |column, i| $stdout.print formats[i] % column.to_s end $stdout.puts end end