MCPcopy Create free account
hub / github.com/github/gh-aw / promptForWorkflowNameFrom

Method promptForWorkflowNameFrom

pkg/cli/interactive.go:129–146  ·  view source on GitHub ↗

promptForWorkflowNameFrom is the non-TTY fallback for promptForWorkflowName. It reads the workflow name from r as plain text. Separated from promptForWorkflowName so it can be exercised in unit tests without a real TTY.

(r io.Reader)

Source from the content-addressed store, hash-verified

127// It reads the workflow name from r as plain text. Separated from promptForWorkflowName
128// so it can be exercised in unit tests without a real TTY.
129func (b *InteractiveWorkflowBuilder) promptForWorkflowNameFrom(r io.Reader) error {
130 interactiveLog.Print("Non-TTY detected, using text prompt for workflow name")
131 fmt.Fprintf(os.Stderr, "\nWorkflow name (e.g. issue-triage, code-review-helper): ")
132
133 scanner := b.ensureNonTTYScanner(r)
134 if scanner.Scan() {
135 name := strings.TrimSpace(scanner.Text())
136 if err := ValidateWorkflowName(name); err != nil {
137 return fmt.Errorf("invalid workflow name %q: %w", name, err)
138 }
139 b.WorkflowName = name
140 return nil
141 }
142 if err := scanner.Err(); err != nil {
143 return fmt.Errorf("failed to read workflow name: %w", err)
144 }
145 return errors.New("no workflow name provided")
146}
147
148// promptForConfiguration organizes all prompts into logical groups with titles and descriptions
149func (b *InteractiveWorkflowBuilder) promptForConfiguration() error {

Calls 4

ensureNonTTYScannerMethod · 0.95
ValidateWorkflowNameFunction · 0.85
PrintMethod · 0.80
ErrorfMethod · 0.45