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

Function issueLabelList

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

Source from the content-addressed store, hash-verified

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

Callers 2

printRawIssuePreviewFunction · 0.70
printHumanIssuePreviewFunction · 0.70

Calls 2

JoinMethod · 0.80
LabelMethod · 0.45

Tested by

no test coverage detected