From 35d8aa21818b8fa26336c9f31b1a66508d905f4a Mon Sep 17 00:00:00 2001 From: DinoMarlir <72864666+DinoMarlir@users.noreply.github.com> Date: Fri, 24 May 2024 21:30:37 +0200 Subject: [PATCH] added information table --- .../me/blueamethyst/bluecloud/node/Node.kt | 4 +- .../bluecloud/node/utils/InformationTable.kt | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 node/src/main/kotlin/me/blueamethyst/bluecloud/node/utils/InformationTable.kt diff --git a/node/src/main/kotlin/me/blueamethyst/bluecloud/node/Node.kt b/node/src/main/kotlin/me/blueamethyst/bluecloud/node/Node.kt index 57d8cd9..ba1f020 100644 --- a/node/src/main/kotlin/me/blueamethyst/bluecloud/node/Node.kt +++ b/node/src/main/kotlin/me/blueamethyst/bluecloud/node/Node.kt @@ -17,6 +17,7 @@ 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.* @@ -24,10 +25,10 @@ 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 @@ -46,6 +47,7 @@ class Node: AbstractSystemPart(InternalSystemPartType.NODE) { private fun initialize() { println(asciiArt()) + printInformationTable() provideInjector() setupFileStructure() provideConfigFile() diff --git a/node/src/main/kotlin/me/blueamethyst/bluecloud/node/utils/InformationTable.kt b/node/src/main/kotlin/me/blueamethyst/bluecloud/node/utils/InformationTable.kt new file mode 100644 index 0000000..a58bee3 --- /dev/null +++ b/node/src/main/kotlin/me/blueamethyst/bluecloud/node/utils/InformationTable.kt @@ -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")) + } + } + } + ) +} \ No newline at end of file