MCPcopy
hub / github.com/cli/cli / issueLabelList

Function issueLabelList

pkg/cmd/issue/view/view.go:446–466  ·  view source on GitHub ↗
(issue *api.Issue, cs *iostreams.ColorScheme)

Source from the content-addressed store, hash-verified

444}
445
446func issueLabelList(issue *api.Issue, cs *iostreams.ColorScheme) string {
447 if len(issue.Labels.Nodes) == 0 {
448 return ""
449 }
450
451 // ignore case sort
452 sort.SliceStable(issue.Labels.Nodes, func(i, j int) bool {
453 return strings.ToLower(issue.Labels.Nodes[i].Name) < strings.ToLower(issue.Labels.Nodes[j].Name)
454 })
455
456 labelNames := make([]string, len(issue.Labels.Nodes))
457 for i, label := range issue.Labels.Nodes {
458 if cs == nil {
459 labelNames[i] = label.Name
460 } else {
461 labelNames[i] = cs.Label(label.Color, label.Name)
462 }
463 }
464
465 return strings.Join(labelNames, ", ")
466}

Callers 2

printRawIssuePreviewFunction · 0.70
printHumanIssuePreviewFunction · 0.70

Calls 2

JoinMethod · 0.80
LabelMethod · 0.45

Tested by

no test coverage detected