MCPcopy Index your code
hub / github.com/coder/coder / promptForNumberVariable

Function promptForNumberVariable

cli/templatepush.go:644–655  ·  view source on GitHub ↗
(inv *serpent.Invocation, variable codersdk.TemplateVersionVariable)

Source from the content-addressed store, hash-verified

642}
643
644func promptForNumberVariable(inv *serpent.Invocation, variable codersdk.TemplateVersionVariable) (string, error) {
645 prompt := "Enter value:"
646 if !variable.Required && variable.DefaultValue != "" {
647 prompt = fmt.Sprintf("Enter value (default: %q):", variable.DefaultValue)
648 }
649
650 return cliui.Prompt(inv, cliui.PromptOptions{
651 Text: prompt,
652 Default: variable.DefaultValue,
653 Validate: createVariableValidator(variable),
654 })
655}
656
657func promptForStringVariable(inv *serpent.Invocation, variable codersdk.TemplateVersionVariable) (string, error) {
658 prompt := "Enter value:"

Callers 1

Calls 2

PromptFunction · 0.92
createVariableValidatorFunction · 0.85

Tested by

no test coverage detected