Skip to content

Commit

Permalink
added information table
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoMarlir committed May 24, 2024
1 parent 8a5c505 commit 35d8aa2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
4 changes: 3 additions & 1 deletion node/src/main/kotlin/me/blueamethyst/bluecloud/node/Node.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ import me.blueamethyst.bluecloud.node.server.KtorApplication
import me.blueamethyst.bluecloud.node.utils.asciiArt
import me.blueamethyst.bluecloud.node.utils.generateRandomSecret
import me.blueamethyst.bluecloud.node.utils.json
import me.blueamethyst.bluecloud.node.utils.printInformationTable
import me.blueamethyst.bluecloud.wrapper.Wrapper
import java.io.File
import java.util.*
import kotlin.system.exitProcess

@InternalBlueCloudApi
class Node: AbstractSystemPart(InternalSystemPartType.NODE) {
val terminal = Terminal()
override val logger = LoggingUtils.getLogger("NODE", terminal.terminal)

companion object {
val terminal = Terminal()
lateinit var logger: Logger
lateinit var config: NodeConfigModel
lateinit var cluster: ClusterConfigModel
Expand All @@ -46,6 +47,7 @@ class Node: AbstractSystemPart(InternalSystemPartType.NODE) {

private fun initialize() {
println(asciiArt())
printInformationTable()
provideInjector()
setupFileStructure()
provideConfigFile()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package me.blueamethyst.bluecloud.node.utils

import com.github.ajalt.mordant.table.table
import me.blueamethyst.bluecloud.api.annontations.InternalBlueCloudApi
import me.blueamethyst.bluecloud.node.Node

@OptIn(InternalBlueCloudApi::class)
fun printInformationTable() {
Node.terminal.terminal.println(
table {
header {
row {
cell("Key")
cell("Value")
}
}
body {
row {
cell("Operating System")
cell(System.getProperty("os.name"))
}
row {
cell("Operating System Version")
cell(System.getProperty("os.version"))
}
row {
cell("Operating System Architecture")
cell(System.getProperty("os.arch"))
}
row {
cell("Java Version")
cell(System.getProperty("java.version"))
}
row {
cell("Java Vendor")
cell(System.getProperty("java.vendor"))
}
}
}
)
}

0 comments on commit 35d8aa2

Please sign in to comment.