INNER CODE UNIT · Go

selectPriceInteractively

theopenlane/core · cmd/catalog/main.go:769

func selectPriceInteractively(prices []catalog.Price) (catalog.Price, error) {
	// Create labels for each price option
	labels := make([]string, len(prices))
	for i, price := range prices {
		amount := float64(price.UnitAmount) / centsToDollars

		label := fmt.Sprintf("$%.2f/%s", amount, price.Interval)
		if price.Nickname != "" {
			label = fmt.Sprintf("%s (%s)", label, price.Nickname)
		}

		labels[i] = label
	}

	prompt := promptui.Select{
		Label: "Select pricing option",
		Items: labels,
		Templates: &promptui.SelectTemplates{

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…