diff --git a/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt b/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt index 1d7b1d7d80..e78c40e1a4 100644 --- a/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt +++ b/test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.kt @@ -6,6 +6,7 @@ import ftl.api.fetchLocales import ftl.args.IosArgs import ftl.presentation.Output import ftl.run.exception.FlankConfigurationError +import ftl.run.exception.FlankGeneralError import java.nio.file.Paths interface DescribeIosLocales : Output { @@ -18,5 +19,5 @@ fun DescribeIosLocales.invoke() { fetchLocales(Identity(IosArgs.loadOrDefault(Paths.get(configPath)).project, Platform.IOS, locale)).find { it.id == locale - }?.out() + }?.out() ?: throw FlankGeneralError("ERROR: '$locale' is not a valid locale") } diff --git a/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt b/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt index a4024f2032..708f4559f4 100644 --- a/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt +++ b/test_runner/src/main/kotlin/ftl/environment/ListLocales.kt @@ -29,14 +29,14 @@ private const val NAME = "NAME" private const val REGION = "REGION" fun List.getLocaleDescription(localeId: String) = - findLocales(localeId)?.prepareDescription(localeId).orErrorMessage(localeId).plus("\n") + findLocales(localeId)?.prepareDescription().orErrorMessage(localeId).plus("\n") private fun List.findLocales(localeId: String) = find { it.id == localeId } -fun Locale.prepareDescription(locale: String) = """ +fun Locale.prepareDescription() = """ id: $id name: $name -""".trimIndent().addRegionIfExist(region).addTagsIfExists(this).orErrorMessage(locale).plus("\n") +""".trimIndent().addRegionIfExist(region).addTagsIfExists(this) private fun String.addRegionIfExist(region: String?) = if (!region.isNullOrEmpty()) StringBuilder(this).appendLine("\nregion: $region").trim().toString() diff --git a/test_runner/src/main/kotlin/ftl/presentation/cli/firebase/test/ios/configuration/IosLocalesDescribeCommand.kt b/test_runner/src/main/kotlin/ftl/presentation/cli/firebase/test/ios/configuration/IosLocalesDescribeCommand.kt index a2baf72e43..459166a960 100644 --- a/test_runner/src/main/kotlin/ftl/presentation/cli/firebase/test/ios/configuration/IosLocalesDescribeCommand.kt +++ b/test_runner/src/main/kotlin/ftl/presentation/cli/firebase/test/ios/configuration/IosLocalesDescribeCommand.kt @@ -44,7 +44,7 @@ class IosLocalesDescribeCommand : override val out = outputLogger { when (this) { - is Locale -> prepareDescription(locale) + is Locale -> prepareDescription() else -> throwUnknownType() } }