Skip to content

Commit

Permalink
refactor: Structural output list provided software
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Adamczyk authored and mergify-bot committed May 11, 2021
1 parent 3636924 commit 50b1a91
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ftl.client.google

import ftl.environment.common.toCliTable
import ftl.http.executeWithRetry

fun providedSoftwareAsTable() = getProvidedSoftware().toCliTable()

internal fun getProvidedSoftware() = GcTesting.get.testEnvironmentCatalog()
.get("provided_software")
.executeWithRetry()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package ftl.domain

import flank.common.logLn
import ftl.api.fetchSoftwareCatalog
import ftl.environment.common.toCliTable
import ftl.presentation.Output

interface ListProvidedSoftware
interface ListProvidedSoftware : Output

operator fun ListProvidedSoftware.invoke() {
logLn(fetchSoftwareCatalog().toCliTable())
fetchSoftwareCatalog().out()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import ftl.api.Orientation
import ftl.config.FtlConstants
import ftl.domain.ListAndroidOrientations
import ftl.domain.invoke
import ftl.environment.common.toCliTable
import ftl.presentation.outputLogger
import ftl.presentation.throwUnknownType
import picocli.CommandLine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ftl.environment.ios.toCliTable
import ftl.presentation.cli.firebase.test.android.orientations.toCliTable
import ftl.presentation.cli.firebase.test.ipblocks.toCliTable
import ftl.presentation.cli.firebase.test.locale.toCliTable
import ftl.presentation.cli.firebase.test.providedsoftware.toCliTable

fun TestEnvironment.Android.prepareOutputString() = buildString {
appendLine(osVersions.toCliTable())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ftl.environment.common
package ftl.presentation.cli.firebase.test.providedsoftware

import com.google.testing.model.ProvidedSoftwareCatalog
import ftl.util.TableColumn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package ftl.presentation.cli.firebase.test.providedsoftware

import com.google.testing.model.ProvidedSoftwareCatalog
import ftl.domain.ListProvidedSoftware
import ftl.domain.invoke
import ftl.presentation.outputLogger
import ftl.presentation.throwUnknownType
import picocli.CommandLine

@CommandLine.Command(
Expand All @@ -18,5 +21,13 @@ import picocli.CommandLine
class ProvidedSoftwareListCommand :
Runnable,
ListProvidedSoftware {

override fun run() = invoke()

override val out = outputLogger {
when (this) {
is ProvidedSoftwareCatalog -> toCliTable()
else -> throwUnknownType()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ftl.environment

import com.google.common.truth.Truth.assertThat
import ftl.api.fetchSoftwareCatalog
import ftl.environment.common.toCliTable
import ftl.presentation.cli.firebase.test.providedsoftware.toCliTable
import ftl.test.util.FlankTestRunner
import io.mockk.unmockkAll
import org.junit.After
Expand Down

0 comments on commit 50b1a91

Please sign in to comment.