| 539 | } |
| 540 | |
| 541 | func promptForJob(prompter shared.Prompter, cs *iostreams.ColorScheme, jobs []shared.Job) (*shared.Job, error) { |
| 542 | candidates := []string{"View all jobs in this run"} |
| 543 | for _, job := range jobs { |
| 544 | symbol, _ := shared.Symbol(cs, job.Status, job.Conclusion) |
| 545 | candidates = append(candidates, fmt.Sprintf("%s %s", symbol, job.Name)) |
| 546 | } |
| 547 | |
| 548 | selected, err := prompter.Select("View a specific job in this run?", "", candidates) |
| 549 | if err != nil { |
| 550 | return nil, err |
| 551 | } |
| 552 | |
| 553 | if selected > 0 { |
| 554 | return &jobs[selected-1], nil |
| 555 | } |
| 556 | |
| 557 | // User wants to see all jobs |
| 558 | return nil, nil |
| 559 | } |
| 560 | |
| 561 | func displayLogSegments(w io.Writer, segments []logSegment) error { |
| 562 | for _, segment := range segments { |