Skip to content

Commit

Permalink
added mordant + renamed Terminal.kt to CLI.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoMarlir committed May 21, 2024
1 parent e466f54 commit a2cd4ef
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ dependencies {
implementation(libs.bundles.ktorClient)
implementation(libs.guice)
implementation(libs.clikt)
implementation(libs.mordant)
implementation(libs.mordantCoroutines)
implementation(kotlin("reflect"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import me.blueamethyst.bluecloud.common.console.Logger
import me.blueamethyst.bluecloud.common.console.cli.command.RootCommand
import java.io.Closeable

class Terminal(
class CLI(
private val logger: Logger,
private val prompt: String,
val subCommands: List<CliktCommand>
): Thread(), Closeable {
): Thread("cli-thread"), Closeable {

var running = false; private set

Expand Down
7 changes: 3 additions & 4 deletions common/src/test/kotlin/ConsoleTest.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import com.github.ajalt.clikt.core.CliktCommand
import me.blueamethyst.bluecloud.common.console.ConsoleColors
import me.blueamethyst.bluecloud.common.console.Logger
import me.blueamethyst.bluecloud.common.console.cli.Terminal
import java.net.InetAddress
import me.blueamethyst.bluecloud.common.console.cli.CLI

fun main() {
val terminal = Terminal(
val cli = CLI(
Logger("Terminal", true),
"${ConsoleColors.YELLOW_BRIGHT}CLI${ConsoleColors.BLACK_BRIGHT}@${ConsoleColors.BLUE_BRIGHT}BlueCloud ${ConsoleColors.BLACK_BRIGHT}» ${ConsoleColors.RESET}",
listOf(
MySubcommand()
)
)

terminal.start()
cli.start()

while (true) {
Thread.sleep(1000)
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ guice = "7.0.0"
ktor = "2.3.11"
kotlinx-serialization = "1.6.3"
clikt = "4.4.0"
mordant = "2.6.0"

[libraries]
kotlinxCoroutinesCore = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
Expand All @@ -15,6 +16,8 @@ ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "
ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }
clikt = { group = "com.github.ajalt.clikt", name = "clikt", version.ref = "clikt" }
mordant = { group = "com.github.ajalt.mordant", name = "mordant", version.ref = "mordant" }
mordantCoroutines = { group = "com.github.ajalt.mordant", name = "mordant-coroutines", version.ref = "mordant" }

[bundles]
ktorClient = ["ktor-client-core", "ktor-client-cio", "ktor-client-content-negotiation", "ktor-serialization-kotlinx-json"]
4 changes: 0 additions & 4 deletions runner/src/test/kotlin/Test.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import me.blueamethyst.bluecloud.api.service.ICloudService
import me.blueamethyst.bluecloud.runner.ProcessRegistry
import java.util.*

/*
fun main() {
val call = ProcessRegistry().getServiceProcess("jvm")!!.constructors.firstOrNull()!!.call()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.blueamethyst.bluecloud.wrapper.logic

import me.blueamethyst.bluecloud.api.annontations.InternalBlueCloudApi
import me.blueamethyst.bluecloud.wrapper.logic.WrapperQueue as Queue
import me.blueamethyst.bluecloud.wrapper.logic.WrapperServiceProcessor as ServiceProcessor
import me.blueamethyst.bluecloud.wrapper.Wrapper.Companion.logger
import java.io.Closeable
import me.blueamethyst.bluecloud.wrapper.logic.WrapperQueue as Queue
import me.blueamethyst.bluecloud.wrapper.logic.WrapperServiceProcessor as ServiceProcessor

@InternalBlueCloudApi
class WrapperWatcher: Thread("wrapper-watcher"), Closeable {
Expand Down

0 comments on commit a2cd4ef

Please sign in to comment.