From efbb35ba236f7fe6cc720396c06f9dfd1f449027 Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Mon, 28 Nov 2022 11:13:21 +0100 Subject: [PATCH] Minor --- .../src/main/kotlin/io/wttech/gradle/config/ConfigExtension.kt | 2 ++ plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugin/src/main/kotlin/io/wttech/gradle/config/ConfigExtension.kt b/plugin/src/main/kotlin/io/wttech/gradle/config/ConfigExtension.kt index 10053da..014d626 100644 --- a/plugin/src/main/kotlin/io/wttech/gradle/config/ConfigExtension.kt +++ b/plugin/src/main/kotlin/io/wttech/gradle/config/ConfigExtension.kt @@ -66,6 +66,8 @@ open class ConfigExtension(val project: Project) { fun valuesSaved(propFilter: (Prop) -> Boolean) = get().valuesSaved(propFilter) + fun valueSaved(propName: String) = get().valueSaved(propName) + fun value(propName: String) = read().value(propName) fun valueOrNull(propName: String) = read().valueOrNull(propName) diff --git a/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt b/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt index a7c60e4..15f23bd 100644 --- a/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt +++ b/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt @@ -110,6 +110,8 @@ open class Definition(val name: String, val project: Project) { fun valuesSaved(propFilter: (Prop) -> Boolean) = props.filter(propFilter).associate { it.name to it.valueSaved() }.toSortedMap() + fun valueSaved(propName: String) = getProp(propName).valueSaved() + fun value(propName: String) = valueOrNull(propName) ?: throw ConfigException("Config '$name' prop '$propName' is null!")