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

Method DisplayOptionalTextPrompt

util/ui/prompt.go:52–62  ·  view source on GitHub ↗

DisplayOptionalTextPrompt outputs the prompt and waits for user input.

(defaultValue string, template string, templateValues ...map[string]interface{})

Source from the content-addressed store, hash-verified

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) {
53 interactivePrompt := ui.Interactor.NewInteraction(ui.TranslateText(template, templateValues...))
54 var value = defaultValue
55 interactivePrompt.SetIn(ui.In)
56 interactivePrompt.SetOut(ui.OutForInteraction)
57 err := interactivePrompt.Resolve(&value)
58 if isInterrupt(err) {
59 ui.Exiter.Exit(sigIntExitCode)
60 }
61 return value, err
62}
63
64// DisplayPasswordPrompt outputs the prompt and waits for user input. Hides
65// user's response from the screen.

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