Skip to content

Commit 8a7d4f8

Browse files
committed
feat: 'features' block for samples config
Signed-off-by: Sam Gammon <sam@elide.dev>
1 parent f016f9a commit 8a7d4f8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/cli/src/main/kotlin/elide/tool/cli/cmd/init/InitCommand.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ internal open class InitCommand : ProjectAwareSubcommand<ToolState, CommandConte
111111
val name: String
112112
val description: String
113113
val languages: Set<String>
114+
val features: SampleFeatures
114115
val noManifest: Boolean
115116
val hasTests: Boolean
116117
val hasBuild: Boolean
@@ -121,6 +122,18 @@ internal open class InitCommand : ProjectAwareSubcommand<ToolState, CommandConte
121122
val tree: Map<Path, ProjectFile>
122123
}
123124

125+
/** Features supported by a given sample project. */
126+
@Serializable @JvmRecord private data class SampleFeatures(
127+
val install: Boolean = true,
128+
val build: Boolean = true,
129+
val test: Boolean = true,
130+
) {
131+
companion object {
132+
/** Default features for a sample project. */
133+
val DEFAULTS = SampleFeatures()
134+
}
135+
}
136+
124137
/** Models project template info as specified in JSON from resources. */
125138
@Serializable @JvmRecord private data class ProjectTemplateInfo(
126139
override val name: String,
@@ -130,6 +143,7 @@ internal open class InitCommand : ProjectAwareSubcommand<ToolState, CommandConte
130143
override val hasDependencies: Boolean = true,
131144
override val hasTests: Boolean = true,
132145
override val hasBuild: Boolean = true,
146+
override val features: SampleFeatures = SampleFeatures.DEFAULTS,
133147
val files: List<String> = emptyList(),
134148
): RenderableTemplateInfo
135149

@@ -177,6 +191,7 @@ internal open class InitCommand : ProjectAwareSubcommand<ToolState, CommandConte
177191
override val hasDependencies: Boolean get() = true
178192
override val hasTests: Boolean get() = true
179193
override val hasBuild: Boolean get() = true
194+
override val features: SampleFeatures get() = SampleFeatures.DEFAULTS
180195
override val tree: Map<Path, ProjectFile> get() = buildMap {
181196
defaultFiles()
182197
}

0 commit comments

Comments
 (0)