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