-
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 iOS models describe (#1895)
Fixes #1850 ## Test Plan > How do we know the code works? - Code is refactored according to #1850 - iOS describe models command works like previously ## Checklist - [x] Unit tested
- Loading branch information
1 parent
944fa26
commit 307b583
Showing
4 changed files
with
32 additions
and
30 deletions.
There are no files selected for viewing
12 changes: 7 additions & 5 deletions
12
test_runner/src/main/kotlin/ftl/domain/DescribeIosModels.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.fetchDeviceModelIos | ||
import ftl.args.IosArgs | ||
import ftl.environment.ios.getDescription | ||
import ftl.presentation.Output | ||
import ftl.run.exception.FlankConfigurationError | ||
import ftl.run.exception.FlankGeneralError | ||
import java.nio.file.Paths | ||
|
||
interface DescribeIosModels { | ||
interface DescribeIosModels : Output { | ||
val modelId: String | ||
val configPath: String | ||
} | ||
|
||
operator fun DescribeIosModels.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(fetchDeviceModelIos(IosArgs.loadOrDefault(Paths.get(configPath)).project).getDescription(modelId)) | ||
fetchDeviceModelIos(IosArgs.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