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

Function promptTrialInfo

cli/login.go:583–600  ·  view source on GitHub ↗
(inv *serpent.Invocation, fieldName string)

Source from the content-addressed store, hash-verified

581}
582
583func promptTrialInfo(inv *serpent.Invocation, fieldName string) (string, error) {
584 value, err := cliui.Prompt(inv, cliui.PromptOptions{
585 Text: fmt.Sprintf("Please enter %s:", pretty.Sprint(cliui.DefaultStyles.Field, fieldName)),
586 Validate: func(s string) error {
587 if strings.TrimSpace(s) == "" {
588 return xerrors.Errorf("%s is required", fieldName)
589 }
590 return nil
591 },
592 })
593 if err != nil {
594 if errors.Is(err, cliui.ErrCanceled) {
595 return "", nil
596 }
597 return "", err
598 }
599 return value, nil
600}
601
602// developerBuckets are the options offered for the "Number of developers"
603// prompt during first-user setup. Keep in sync with

Callers 1

loginMethod · 0.85

Calls 3

PromptFunction · 0.92
ErrorfMethod · 0.45
IsMethod · 0.45

Tested by

no test coverage detected