PrintCommentTable prints comments in a formatted table.
(comments []models.Comment)
| 574 | |
| 575 | // PrintCommentTable prints comments in a formatted table. |
| 576 | func PrintCommentTable(comments []models.Comment) { |
| 577 | if len(comments) == 0 { |
| 578 | fmt.Println("No comments.") |
| 579 | return |
| 580 | } |
| 581 | |
| 582 | for i, c := range comments { |
| 583 | badge := c.CreatedBy |
| 584 | if c.Author != "" && c.Author != c.CreatedBy { |
| 585 | badge = c.Author + " (" + c.CreatedBy + ")" |
| 586 | } |
| 587 | fmt.Printf("💬 %s • %s via %s\n", badge, RelativeTime(c.CreatedAt), c.Source) |
| 588 | fmt.Println(c.Body) |
| 589 | if i < len(comments)-1 { |
| 590 | fmt.Println() |
| 591 | } |
| 592 | } |
| 593 | } |
no test coverage detected