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

Function issueLabelList

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

Source from the content-addressed store, hash-verified

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

Callers 2

printRawIssuePreviewFunction · 0.70
printHumanIssuePreviewFunction · 0.70

Calls 2

JoinMethod · 0.80
LabelMethod · 0.45

Tested by

no test coverage detected