MCPcopy
hub / github.com/cli/cli / runForm

Method runForm

internal/prompter/huh_prompter.go:29–39  ·  view source on GitHub ↗
(form *huh.Form)

Source from the content-addressed store, hash-verified

27}
28
29func (p *huhPrompter) runForm(form *huh.Form) error {
30 err := form.Run()
31 if errors.Is(err, huh.ErrUserAborted) {
32 // TODO(huh-prompter-improvements)
33 // It's unfortunate that we take a dependency on survey/terminal here, but our clean cancellation logic
34 // in cmd.go expects it. Better would be to have a prompter.Cancelled sentinel error, but then we need to
35 // go and change non-experimental code to do so, and I don't think we should take that on right now.
36 return terminal.InterruptErr
37 }
38 return err
39}
40
41func (p *huhPrompter) buildSelectForm(prompt, defaultValue string, options []string) (*huh.Form, *int) {
42 var result int

Callers 11

SelectMethod · 0.95
MultiSelectMethod · 0.95
MultiSelectWithSearchMethod · 0.95
InputMethod · 0.95
PasswordMethod · 0.95
ConfirmMethod · 0.95
AuthTokenMethod · 0.95
ConfirmDeletionMethod · 0.95
InputHostnameMethod · 0.95
MarkdownEditorMethod · 0.95

Calls 1

RunMethod · 0.65

Tested by 1