From f0c4ac330ab714e73a60dfdce25071a9e1f999e7 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Wed, 27 Nov 2024 00:20:38 +0100 Subject: Remove some more args --- src/main/kotlin/moe/nea/firm/ManagedConfig.kt | 20 +------------------- src/main/kotlin/moe/nea/firm/User.kt | 9 +++++---- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'src/main') diff --git a/src/main/kotlin/moe/nea/firm/ManagedConfig.kt b/src/main/kotlin/moe/nea/firm/ManagedConfig.kt index 87d35cc..0c2b8b4 100644 --- a/src/main/kotlin/moe/nea/firm/ManagedConfig.kt +++ b/src/main/kotlin/moe/nea/firm/ManagedConfig.kt @@ -5,36 +5,18 @@ import kotlin.enums.enumEntries abstract class ManagedConfig(val identifier: String) { - protected fun option( - propertyName: String, - default: () -> T, -// handler: OptionHandler - ): ManagedOption { - return TODO() - } - protected fun choice( - propertyName: String, - universe: List, codec: Codec, renderer: EnumRenderer, - default: () -> E ): ManagedOption { - return option(propertyName, default, -// ChoiceHandler(universe, codec, renderer) - ) + return TODO() } protected inline fun choice( - propertyName: String, - noinline default: () -> E ): ManagedOption where E : Enum, E : StringIdentifiable { return choice( - propertyName, - enumEntries().toList(), StringIdentifiable.createCodec { enumValues() }, EnumRenderer.default(), - default ) } } diff --git a/src/main/kotlin/moe/nea/firm/User.kt b/src/main/kotlin/moe/nea/firm/User.kt index 09b0b73..080f93a 100644 --- a/src/main/kotlin/moe/nea/firm/User.kt +++ b/src/main/kotlin/moe/nea/firm/User.kt @@ -4,10 +4,11 @@ import ext.StringIdentifiable import kotlin.enums.enumEntries object User : ManagedConfig("test") { - val option by choice("name") { TestEnum.A } - val optionAlt by choice("name", enumEntries(), + val option by choice() + val optionAlt by choice(enumEntries(), StringIdentifiable.createCodec { enumValues() }, - EnumRenderer.default()) { TestEnum.A } + EnumRenderable.default(), + ) enum class TestEnum : StringIdentifiable { A, B, C; @@ -15,4 +16,4 @@ object User : ManagedConfig("test") { } fun main() { User.option -} \ No newline at end of file +} -- cgit