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

Function issueLabelList

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

Source from the content-addressed store, hash-verified

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

Callers 2

printRawIssuePreviewFunction · 0.70
printHumanIssuePreviewFunction · 0.70

Calls 2

JoinMethod · 0.80
LabelMethod · 0.45

Tested by

no test coverage detected