MCPcopy
hub / github.com/cli/cli / labelList

Function labelList

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

Source from the content-addressed store, hash-verified

600}
601
602func 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
623func printHumanCommentAndReplies(opts *ViewOptions, c *client.DiscussionComment) error {
624 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