(labels []client.DiscussionLabel, cs *iostreams.ColorScheme)
| 600 | } |
| 601 | |
| 602 | func labelList(labels []client.DiscussionLabel, cs *iostreams.ColorScheme) string { |
| 603 | if len(labels) == 0 { |
| 604 | return "" |
| 605 | } |
| 606 | |
| 607 | sortedLabels := slices.Clone(labels) |
| 608 | slices.SortStableFunc(sortedLabels, func(i, j client.DiscussionLabel) int { |
| 609 | return strings.Compare(i.Name, j.Name) |
| 610 | }) |
| 611 | |
| 612 | names := make([]string, len(sortedLabels)) |
| 613 | for i, l := range sortedLabels { |
| 614 | if cs == nil { |
| 615 | names[i] = l.Name |
| 616 | } else { |
| 617 | names[i] = cs.Label(l.Color, l.Name) |
| 618 | } |
| 619 | } |
| 620 | return strings.Join(names, ", ") |
| 621 | } |
| 622 | |
| 623 | func printHumanCommentAndReplies(opts *ViewOptions, c *client.DiscussionComment) error { |
| 624 | out := opts.IO.Out |
no test coverage detected