MCPcopy Index your code
hub / github.com/cloudfoundry/cli / DisplayBoolPrompt

Method DisplayBoolPrompt

util/ui/prompt.go:36–49  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

34// allows for a boolean response. A default boolean response can be set with
35// defaultResponse.
36func (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.
52func (ui *UI) DisplayOptionalTextPrompt(defaultValue string, template string, templateValues ...map[string]interface{}) (string, error) {

Callers

nothing calls this directly

Calls 7

TranslateTextMethod · 0.95
isInterruptFunction · 0.85
NewInteractionMethod · 0.65
SetInMethod · 0.65
SetOutMethod · 0.65
ResolveMethod · 0.65
ExitMethod · 0.65

Tested by

no test coverage detected