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