INNER CODE UNIT · Go
promptAndCreateMissing
theopenlane/core · cmd/catalog/main.go:500
func promptAndCreateMissing(ctx context.Context, cat *catalog.Catalog, sc *entitlements.StripeClient) error {
fmt.Print("Create missing products and prices? (y/N): ")
r := bufio.NewReader(os.Stdin)
answer, err := r.ReadString('\n')
if err != nil {
return err
}
answer = strings.ToLower(strings.TrimSpace(answer))
if answer == "y" || answer == "yes" {
if err := cat.EnsurePrices(ctx, sc, "usd"); err != nil {
log.Error().Err(err).Msg("failed to ensure prices")
return err
}
}