| 27 | } |
| 28 | |
| 29 | func (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 | |
| 41 | func (p *huhPrompter) buildSelectForm(prompt, defaultValue string, options []string) (*huh.Form, *int) { |
| 42 | var result int |