MCPcopy Index your code
hub / github.com/rilldata/rill / SelectPrompt

Function SelectPrompt

cli/pkg/cmdutil/prompt.go:11–26  ·  view source on GitHub ↗
(msg string, options []string, def string)

Source from the content-addressed store, hash-verified

9)
10
11func SelectPrompt(msg string, options []string, def string) (string, error) {
12 prompt := &survey.Select{
13 Message: msg,
14 Options: options,
15 }
16
17 if slices.Contains(options, def) {
18 prompt.Default = def
19 }
20
21 result := ""
22 if err := survey.AskOne(prompt, &result); err != nil {
23 return "", fmt.Errorf("prompt failed: %w", err)
24 }
25 return result, nil
26}
27
28// SelectPromptWithDescriptions is like SelectPrompt but shows a description next to each option.
29// The descriptions slice must be the same length as options.

Callers 15

StartCmdFunction · 0.92
SwitchEnvCmdFunction · 0.92
SelectOrgFlowFunction · 0.92
SetRoleCmdFunction · 0.92
AddCmdFunction · 0.92
RenameCmdFunction · 0.92
JwtCmdFunction · 0.92
createGithubRepoFlowFunction · 0.92
SetRoleCmdFunction · 0.92
CreateCmdFunction · 0.92
InitCmdFunction · 0.92
SwitchSelectFlowFunction · 0.92

Calls 2

ContainsMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected