| 554 | } |
| 555 | |
| 556 | func promptForJob(prompter shared.Prompter, cs *iostreams.ColorScheme, jobs []shared.Job) (*shared.Job, error) { |
| 557 | candidates := []string{"View all jobs in this run"} |
| 558 | for _, job := range jobs { |
| 559 | symbol, _ := shared.Symbol(cs, job.Status, job.Conclusion) |
| 560 | candidates = append(candidates, fmt.Sprintf("%s %s", symbol, job.Name)) |
| 561 | } |
| 562 | |
| 563 | selected, err := prompter.Select("View a specific job in this run?", "", candidates) |
| 564 | if err != nil { |
| 565 | return nil, err |
| 566 | } |
| 567 | |
| 568 | if selected > 0 { |
| 569 | return &jobs[selected-1], nil |
| 570 | } |
| 571 | |
| 572 | // User wants to see all jobs |
| 573 | return nil, nil |
| 574 | } |
| 575 | |
| 576 | func displayLogSegments(w io.Writer, segments []logSegment) error { |
| 577 | for _, segment := range segments { |