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

Function labelList

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

Source from the content-addressed store, hash-verified

607}
608
609func 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
630func printHumanCommentAndReplies(opts *ViewOptions, c *client.DiscussionComment) error {
631 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