Flush computes column widths and writes all rows to w.
(w io.Writer)
| 44 | |
| 45 | // Flush computes column widths and writes all rows to w. |
| 46 | func (tw *TableWriter) Flush(w io.Writer) { |
| 47 | if len(tw.rows) == 0 { |
| 48 | return |
| 49 | } |
| 50 | |
| 51 | widths := tw.columnWidths() |
| 52 | |
| 53 | for _, row := range tw.rows { |
| 54 | if row.isSep { |
| 55 | tw.writeSeparator(w, widths) |
| 56 | continue |
| 57 | } |
| 58 | tw.writeRow(w, row, widths) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // columnWidths returns the max visible width for each column. |
| 63 | func (tw *TableWriter) columnWidths() []int { |