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

Function promptForJob

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

Source from the content-addressed store, hash-verified

554}
555
556func 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
576func displayLogSegments(w io.Writer, segments []logSegment) error {
577 for _, segment := range segments {

Callers 1

runViewFunction · 0.85

Calls 2

SymbolFunction · 0.92
SelectMethod · 0.65

Tested by

no test coverage detected