MCPcopy Create free account
hub / github.com/cli/cli / promptForJob

Function promptForJob

pkg/cmd/run/view/view.go:541–559  ·  view source on GitHub ↗
(prompter shared.Prompter, cs *iostreams.ColorScheme, jobs []shared.Job)

Source from the content-addressed store, hash-verified

539}
540
541func 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
561func displayLogSegments(w io.Writer, segments []logSegment) error {
562 for _, segment := range segments {

Callers 1

runViewFunction · 0.85

Calls 2

SymbolFunction · 0.92
SelectMethod · 0.65

Tested by

no test coverage detected