DisplayBoolPrompt outputs the prompt and waits for user input. It only allows for a boolean response. A default boolean response can be set with defaultResponse.
(defaultResponse bool, template string, templateValues ...map[string]interface{})
| 34 | // allows for a boolean response. A default boolean response can be set with |
| 35 | // defaultResponse. |
| 36 | func (ui *UI) DisplayBoolPrompt(defaultResponse bool, template string, templateValues ...map[string]interface{}) (bool, error) { |
| 37 | ui.terminalLock.Lock() |
| 38 | defer ui.terminalLock.Unlock() |
| 39 | |
| 40 | response := defaultResponse |
| 41 | interactivePrompt := ui.Interactor.NewInteraction(ui.TranslateText(template, templateValues...)) |
| 42 | interactivePrompt.SetIn(ui.In) |
| 43 | interactivePrompt.SetOut(ui.OutForInteraction) |
| 44 | err := interactivePrompt.Resolve(&response) |
| 45 | if isInterrupt(err) { |
| 46 | ui.Exiter.Exit(sigIntExitCode) |
| 47 | } |
| 48 | return response, err |
| 49 | } |
| 50 | |
| 51 | // DisplayOptionalTextPrompt outputs the prompt and waits for user input. |
| 52 | func (ui *UI) DisplayOptionalTextPrompt(defaultValue string, template string, templateValues ...map[string]interface{}) (string, error) { |
nothing calls this directly
no test coverage detected