class Thor::Shell::Basic
def print_in_columns(array)
Array[String, String, ...]
==== Parameters
Prints values in columns
def print_in_columns(array) return if array.empty? colwidth = (array.map{|el| el.to_s.size}.max || 0) + 2 array.each_with_index do |value, index| # Don't output trailing spaces when printing the last column if ((((index + 1) % (terminal_width / colwidth))).zero? && !index.zero?) || index + 1 == array.length stdout.puts value else stdout.printf("%-#{colwidth}s", value) end end end