| 41 | } |
| 42 | } |
| 43 | |
| 44 | // addRow adds a row, sanitizing every cell on the way in: a table is where server |
| 45 | // data lands most often, and a cell is one line by construction. |
| 46 | func (t *table) addRow(row []string) { |
| 47 | cells := make([]string, len(row)) |
| 48 | for i, cell := range row { |
| 49 | cells[i] = terminal.SanitizeLine(cell) |
| 50 | } |
| 51 | t.updateColumnWidths(cells) |
| 52 | t.rows = append(t.rows, cells) |
| 53 | } |
| 54 | |
| 55 | func (t *table) print() { |
| 56 | for rownum, row := range t.rows { |
| 57 | for i, cell := range row { |
| 58 | cellStyle := plain |
| 59 | if rownum == 0 { |
| 60 | cellStyle = italic |
| 61 | } |
| 62 | if rownum > 0 && i == 0 { |