forked from SteamWar/SteamWar
26 lines
682 B
Kotlin
26 lines
682 B
Kotlin
package de.steamwar.commands.database
|
|
|
|
import com.github.ajalt.clikt.core.CliktCommand
|
|
import com.github.ajalt.clikt.core.requireObject
|
|
import com.github.ajalt.mordant.table.table
|
|
import de.steamwar.db.Database
|
|
import de.steamwar.db.execute
|
|
import de.steamwar.db.useDb
|
|
|
|
class InfoCommand : CliktCommand() {
|
|
val db by requireObject<Database>()
|
|
|
|
override fun run() =
|
|
useDb {
|
|
val tables = execute("SHOW TABLES") { it.getString(1) }
|
|
|
|
echo(
|
|
table {
|
|
header { row("Name") }
|
|
body {
|
|
tables.map { row(it) }
|
|
}
|
|
}
|
|
)
|
|
}
|
|
} |