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