MCPcopy Create free account
hub / github.com/algolia/cli / SelectablePlans

Function SelectablePlans

pkg/cmd/shared/apputil/plan.go:91–102  ·  view source on GitHub ↗

SelectablePlans returns the plans a user may choose from. When hideNonFree is true (no payment method on file) only the free plan(s) are offered, because paid plans require billing details the CLI can't collect.

(plans []dashboard.Plan, hideNonFree bool)

Source from the content-addressed store, hash-verified

89// true (no payment method on file) only the free plan(s) are offered, because
90// paid plans require billing details the CLI can't collect.
91func SelectablePlans(plans []dashboard.Plan, hideNonFree bool) []dashboard.Plan {
92 if !hideNonFree {
93 return plans
94 }
95 free := make([]dashboard.Plan, 0, 1)
96 for _, p := range plans {
97 if p.IsFree() {
98 free = append(free, p)
99 }
100 }
101 return free
102}
103
104// FindFreePlan returns the free-tier plan, or nil if none is present.
105func FindFreePlan(plans []dashboard.Plan) *dashboard.Plan {

Callers 1

selectPlanFunction · 0.92

Calls 1

IsFreeMethod · 0.80

Tested by

no test coverage detected