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

Function promptForJob

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

Source from the content-addressed store, hash-verified

541}
542
543func 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
563func displayLogSegments(w io.Writer, segments []logSegment) error {
564 for _, segment := range segments {

Callers 1

runViewFunction · 0.85

Calls 2

SymbolFunction · 0.92
SelectMethod · 0.65

Tested by

no test coverage detected