-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
12 deletions.
There are no files selected for viewing
20 changes: 8 additions & 12 deletions
20
test_runner/src/main/kotlin/ftl/domain/DescribeAndroidLocales.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
package ftl.domain | ||
|
||
import flank.common.log | ||
import ftl.api.Locale | ||
import ftl.api.Locale.Identity | ||
import ftl.api.Platform | ||
import ftl.api.fetchLocales | ||
import ftl.args.AndroidArgs | ||
import ftl.presentation.cli.firebase.test.locale.getLocaleDescription | ||
import ftl.presentation.Output | ||
import ftl.run.exception.FlankConfigurationError | ||
import ftl.run.exception.FlankGeneralError | ||
import java.nio.file.Paths | ||
|
||
interface DescribeAndroidLocales { | ||
interface DescribeAndroidLocales : Output { | ||
val locale: String | ||
val configPath: String | ||
} | ||
|
||
fun DescribeAndroidLocales.invoke() { | ||
if (locale.isBlank()) throw FlankConfigurationError("Argument LOCALE must be specified.") | ||
log( | ||
fetchLocales( | ||
Locale.Identity( | ||
AndroidArgs.loadOrDefault(Paths.get(configPath)).project, | ||
Platform.ANDROID | ||
) | ||
).getLocaleDescription(locale) | ||
) | ||
|
||
fetchLocales(Identity(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, Platform.ANDROID)).find { | ||
it.id == locale | ||
}?.out() ?: throw FlankGeneralError("ERROR: '$locale' is not a valid locale") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters