MCPcopy
hub / github.com/cli/cli / PrintIssues

Function PrintIssues

pkg/cmd/issue/shared/display.go:16–49  ·  view source on GitHub ↗
(io *iostreams.IOStreams, now time.Time, prefix string, totalCount int, issues []api.Issue)

Source from the content-addressed store, hash-verified

14)
15
16func PrintIssues(io *iostreams.IOStreams, now time.Time, prefix string, totalCount int, issues []api.Issue) {
17 cs := io.ColorScheme()
18 isTTY := io.IsStdoutTTY()
19 headers := []string{"ID"}
20 if !isTTY {
21 headers = append(headers, "STATE")
22 }
23 headers = append(headers,
24 "TITLE",
25 "LABELS",
26 "UPDATED",
27 )
28 table := tableprinter.New(io, tableprinter.WithHeader(headers...))
29 for _, issue := range issues {
30 issueNum := strconv.Itoa(issue.Number)
31 if isTTY {
32 issueNum = "#" + issueNum
33 }
34 issueNum = prefix + issueNum
35 table.AddField(issueNum, tableprinter.WithColor(cs.ColorFromString(prShared.ColorForIssueState(issue))))
36 if !isTTY {
37 table.AddField(issue.State)
38 }
39 table.AddField(text.RemoveExcessiveWhitespace(issue.Title))
40 table.AddField(issueLabelList(&issue, cs, isTTY))
41 table.AddTimeField(now, issue.UpdatedAt, cs.Muted)
42 table.EndRow()
43 }
44 _ = table.Render()
45 remaining := totalCount - len(issues)
46 if remaining > 0 {
47 fmt.Fprintf(io.Out, cs.Muted("%sAnd %d more\n"), prefix, remaining)
48 }
49}
50
51func issueLabelList(issue *api.Issue, cs *iostreams.ColorScheme, colorize bool) string {
52 if len(issue.Labels.Nodes) == 0 {

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
WithHeaderFunction · 0.92
ColorSchemeMethod · 0.80
IsStdoutTTYMethod · 0.80
ColorFromStringMethod · 0.80
AddTimeFieldMethod · 0.80
MutedMethod · 0.80
issueLabelListFunction · 0.70
RenderMethod · 0.65

Tested by

no test coverage detected