(builder *strings.Builder, row []string, widths []int)
| 271 | } |
| 272 | |
| 273 | func writeHumanTableRow(builder *strings.Builder, row []string, widths []int) { |
| 274 | for column, cell := range row { |
| 275 | if column > 0 { |
| 276 | builder.WriteString(" ") |
| 277 | } |
| 278 | builder.WriteString(cell) |
| 279 | if column < len(row)-1 && column < len(widths) { |
| 280 | builder.WriteString(strings.Repeat(" ", max(0, widths[column]-humanTableCellWidth(cell)))) |
| 281 | } |
| 282 | } |
| 283 | builder.WriteByte('\n') |
| 284 | } |
| 285 | |
| 286 | func humanTableCellWidth(cell string) int { |
| 287 | return utf8.RuneCountInString(cell) |
no test coverage detected