MCPcopy Index your code
hub / github.com/cli/cli / RenderJobs

Function RenderJobs

pkg/cmd/run/shared/presentation.go:28–48  ·  view source on GitHub ↗
(cs *iostreams.ColorScheme, jobs []Job, verbose bool)

Source from the content-addressed store, hash-verified

26}
27
28func RenderJobs(cs *iostreams.ColorScheme, jobs []Job, verbose bool) string {
29 lines := []string{}
30 for _, job := range jobs {
31 elapsed := job.CompletedAt.Sub(job.StartedAt)
32 elapsedStr := fmt.Sprintf(" in %s", elapsed)
33 if elapsed < 0 {
34 elapsedStr = ""
35 }
36 symbol, symbolColor := Symbol(cs, job.Status, job.Conclusion)
37 id := cs.Cyanf("%d", job.ID)
38 lines = append(lines, fmt.Sprintf("%s %s%s (ID %s)", symbolColor(symbol), cs.Bold(job.Name), elapsedStr, id))
39 if verbose || IsFailureState(job.Conclusion) {
40 for _, step := range job.Steps {
41 stepSymbol, stepSymColor := Symbol(cs, step.Status, step.Conclusion)
42 lines = append(lines, fmt.Sprintf(" %s %s", stepSymColor(stepSymbol), step.Name))
43 }
44 }
45 }
46
47 return strings.Join(lines, "\n")
48}
49
50func RenderJobsCompact(cs *iostreams.ColorScheme, jobs []Job) string {
51 lines := []string{}

Callers 3

runViewFunction · 0.92
renderRunFunction · 0.92
TestRenderJobsFunction · 0.85

Calls 5

SymbolFunction · 0.85
IsFailureStateFunction · 0.85
CyanfMethod · 0.80
BoldMethod · 0.80
JoinMethod · 0.80

Tested by 1

TestRenderJobsFunction · 0.68