| 581 | } |
| 582 | |
| 583 | func 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 |