feat: enum conditionals
Description
I'm trying to create an app template that can be optionally compatible with Serverpod & Dart Frog. I'd originally created with without server support, then added Serverpod support via a boolean. Now, I'd like to additionaly add optional support for Dart Frog, but it shouldn't be possible to create an app supporting both Serverpod and Dart Frog. Therefore, I'd like to convert it my boolean to an enum. However, there does not appear to be (at least documented) support for switch-cases in mason.
Requirements
- [ ] Allow switch-casing (or equivalent) over enums in mason
Additional Context
n/a?
Mason's brick.yaml supports enum types
Here is an example from the favorite color example:
name: favorite_color
description: A new brick created with the Mason CLI.
version: 0.1.0+1
environment:
mason: ">=0.1.0-dev <0.1.0"
vars:
color:
type: enum
description: Your favorite color
default: green
prompt: What is your favorite color?
values:
- red
- green
- blue
Mason's
brick.yamlsupportsenumtypes.
Yes, the issue is that you can't case over them. I'd like to define
server:
type: enum
values:
- none
- serverpod
- dart_frog
and then do the following in my templates:
{{server.none}}
{{/server.none}}
// or
{{server}}
{{.none}}{{/.none}}
{{.dart_frog}}{{/.dart_frog}}
{{/server}}