DisplayKeyValueTable outputs a matrix of strings as a table to UI.Out. Prefix will be prepended to each row and padding adds the specified number of spaces between columns. The final columns may wrap to multiple lines but will still be confined to the last column. Wrapping will occur on word boundar
(prefix string, table [][]string, padding int)
| 18 | // will still be confined to the last column. Wrapping will occur on word |
| 19 | // boundaries. |
| 20 | func (ui *UI) DisplayKeyValueTable(prefix string, table [][]string, padding int) { |
| 21 | rows := len(table) |
| 22 | if rows == 0 { |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | var displayTable [][]string |
| 27 | for _, row := range table { |
| 28 | if len(row) > 0 { |
| 29 | displayTable = append(displayTable, row) |
| 30 | } |
| 31 | } |
| 32 | columns := len(displayTable[0]) |
| 33 | |
| 34 | if columns < 2 || !ui.IsTTY { |
| 35 | ui.DisplayNonWrappingTable(prefix, displayTable, padding) |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | ui.displayWrappingTableWithWidth(prefix, displayTable, padding) |
| 40 | } |
| 41 | |
| 42 | // DisplayNonWrappingTable outputs a matrix of strings as a table to UI.Out. |
| 43 | // Prefix will be prepended to each row and padding adds the specified number |
no test coverage detected