class Thor::Shell::TablePrinter
def prepare(array)
def prepare(array) array = array.reject{|row| row == BORDER_SEPARATOR } @formats << "%-#{@colwidth + 2}s".dup if @colwidth start = @colwidth ? 1 : 0 colcount = array.max { |a, b| a.size <=> b.size }.size start.upto(colcount - 1) do |index| maxima = array.map { |row| row[index] ? row[index].to_s.size : 0 }.max @maximas << maxima @formats << if options[:borders] "%-#{maxima}s".dup elsif index == colcount - 1 # Don't output 2 trailing spaces when printing the last column "%-s".dup else "%-#{maxima + 2}s".dup end end @formats << "%s" end