MCPcopy Index your code
hub / github.com/cli/cli / promptForJob

Function promptForJob

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

Source from the content-addressed store, hash-verified

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

Callers 1

runViewFunction · 0.85

Calls 2

SymbolFunction · 0.92
SelectMethod · 0.65

Tested by

no test coverage detected