MCPcopy Create free account
hub / github.com/cli/cli / labelList

Function labelList

pkg/cmd/discussion/view/view.go:607–626  ·  view source on GitHub ↗
(labels []client.DiscussionLabel, cs *iostreams.ColorScheme)

Source from the content-addressed store, hash-verified

605}
606
607func 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
628func printHumanCommentAndReplies(opts *ViewOptions, c *client.DiscussionComment) error {
629 out := opts.IO.Out

Callers 2

printHumanViewFunction · 0.85
printRawViewFunction · 0.85

Calls 3

JoinMethod · 0.80
CloneMethod · 0.65
LabelMethod · 0.45

Tested by

no test coverage detected