Skip to content

Commit

Permalink
Update Impoortmaps::Command#puts_table to be markdown compatible (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
faqndo97 committed Jan 3, 2024
1 parent 59b6862 commit 25e9166
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/importmap/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,13 @@ def puts_table(array)
row.each_with_index.map{ |iterand, index| [lengths[index] || 0, iterand.to_s.length].max }
end

puts head = "+" + (column_sizes.map { |s| "-" * (s + 2) }.join('+')) + '+'
divider = "|" + (column_sizes.map { |s| "-" * (s + 2) }.join('|')) + '|'
array.each_with_index do |row, row_number|
row = row.fill(nil, row.size..(column_sizes.size - 1))
row = row.each_with_index.map { |v, i| v.to_s + " " * (column_sizes[i] - v.to_s.length) }
puts "| " + row.join(" | ") + " |"
puts head if row_number == 0
puts divider if row_number == 0
end
puts head
end
end

Expand Down

0 comments on commit 25e9166

Please sign in to comment.