-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Structural output Android models describe (#1887)
Fixes #1846 ## Test Plan > How do we know the code works? - Code is refactored according to #1846 - Android describe models command works like previously ## Checklist - [x] Unit tested
- Loading branch information
1 parent
b3c4a76
commit 26d516e
Showing
4 changed files
with
26 additions
and
31 deletions.
There are no files selected for viewing
12 changes: 7 additions & 5 deletions
12
test_runner/src/main/kotlin/ftl/domain/DescribeAndroidModels.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,19 +1,21 @@ | ||
package ftl.domain | ||
|
||
import flank.common.logLn | ||
import ftl.api.fetchDeviceModelAndroid | ||
import ftl.args.AndroidArgs | ||
import ftl.environment.android.getDescription | ||
import ftl.presentation.Output | ||
import ftl.run.exception.FlankConfigurationError | ||
import ftl.run.exception.FlankGeneralError | ||
import java.nio.file.Paths | ||
|
||
interface DescribeAndroidModels { | ||
interface DescribeAndroidModels : Output { | ||
val configPath: String | ||
val modelId: String | ||
} | ||
|
||
operator fun DescribeAndroidModels.invoke() { | ||
if (modelId.isBlank()) throw FlankConfigurationError("Argument MODEL_ID must be specified.") | ||
// TODO move getDescription() and printing presentation layer during refactor of presentation after #1728 | ||
logLn(fetchDeviceModelAndroid(AndroidArgs.loadOrDefault(Paths.get(configPath)).project).getDescription(modelId)) | ||
fetchDeviceModelAndroid(AndroidArgs.loadOrDefault(Paths.get(configPath)).project) | ||
.find { it.id == modelId } | ||
?.out() | ||
?: throw FlankGeneralError("ERROR: '$modelId' is not a valid model") | ||
} |
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
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
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