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

Function promptForJob

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

Source from the content-addressed store, hash-verified

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

Callers 1

runViewFunction · 0.85

Calls 2

SymbolFunction · 0.92
SelectMethod · 0.65

Tested by

no test coverage detected