selectPlan static method
Implementation
static Future<void> selectPlan(
final Client cloudApiClient,
final CommandLogger logger,
final ProjectLaunch projectSetup,
) async {
final validPlanNames = PlanProfile.values
.map((final p) => p.name)
.join(', ');
var planProfile = projectSetup.plan;
do {
if (planProfile != null) {
projectSetup.plan = planProfile;
return;
}
final projectPlanName = await logger.input('Enter the plan');
if (projectPlanName.isEmpty) {
logger.error('Plan is required. Must be one of: $validPlanNames');
continue;
}
planProfile = PlanProfile.values
.where((final p) => p.name == projectPlanName)
.firstOrNull;
if (planProfile == null) {
logger.error('Invalid plan. Must be one of: $validPlanNames');
continue;
}
} while (true);
}