|
| 1 | +package ftl.cli.firebase.test.android.configuration |
| 2 | + |
| 3 | +import ftl.android.AndroidCatalog.getLocaleDescription |
| 4 | +import ftl.args.AndroidArgs |
| 5 | +import ftl.config.FtlConstants |
| 6 | +import ftl.util.FlankConfigurationError |
| 7 | +import picocli.CommandLine |
| 8 | +import java.nio.file.Paths |
| 9 | + |
| 10 | +@CommandLine.Command( |
| 11 | + name = "describe", |
| 12 | + headerHeading = "", |
| 13 | + synopsisHeading = "%n", |
| 14 | + descriptionHeading = "%n@|bold,underline Description:|@%n%n", |
| 15 | + parameterListHeading = "%n@|bold,underline Parameters:|@%n", |
| 16 | + optionListHeading = "%n@|bold,underline Options:|@%n", |
| 17 | + header = ["Describe a locales "], |
| 18 | + usageHelpAutoWidth = true |
| 19 | +) |
| 20 | +class AndroidLocalesDescribeCommand : Runnable { |
| 21 | + override fun run() { |
| 22 | + if (locale.isBlank()) throw FlankConfigurationError("Argument LOCALE must be specified.") |
| 23 | + print(getLocaleDescription(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, locale)) |
| 24 | + } |
| 25 | + |
| 26 | + @CommandLine.Parameters( |
| 27 | + index = "0", |
| 28 | + arity = "1", |
| 29 | + paramLabel = "LOCALE", |
| 30 | + defaultValue = "", |
| 31 | + description = ["The locale to describe, found" + |
| 32 | + " using \$ gcloud firebase test android locales list\n."] |
| 33 | + ) |
| 34 | + var locale: String = "" |
| 35 | + |
| 36 | + @CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"]) |
| 37 | + var configPath: String = FtlConstants.defaultAndroidConfig |
| 38 | +} |
0 commit comments