Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Structural output list provided software #1919

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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