From b1f5b423a16ef8c5fc78b0e618eeef11cf35b43d Mon Sep 17 00:00:00 2001 From: AJ Alt Date: Fri, 13 Sep 2024 01:11:05 +0000 Subject: [PATCH] Update mordant to 3.0 (#546) --- clikt-mordant/build.gradle.kts | 1 + .../com/github/ajalt/clikt/testing/CliktTesting.kt | 6 +++++- .../ajalt/clikt/parameters/PromptOptionsTest.kt | 1 + .../github/ajalt/clikt/testing/TestingUtilsTest.kt | 14 +++++++------- gradle/libs.versions.toml | 4 +++- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/clikt-mordant/build.gradle.kts b/clikt-mordant/build.gradle.kts index b02660d4..bb25a8ab 100644 --- a/clikt-mordant/build.gradle.kts +++ b/clikt-mordant/build.gradle.kts @@ -31,6 +31,7 @@ kotlin { dependencies { api(project(":clikt")) api(libs.mordant) + api(libs.mordant.markdown) } } diff --git a/clikt-mordant/src/commonMain/kotlin/com/github/ajalt/clikt/testing/CliktTesting.kt b/clikt-mordant/src/commonMain/kotlin/com/github/ajalt/clikt/testing/CliktTesting.kt index 5fc5fd33..9371e7cd 100644 --- a/clikt-mordant/src/commonMain/kotlin/com/github/ajalt/clikt/testing/CliktTesting.kt +++ b/clikt-mordant/src/commonMain/kotlin/com/github/ajalt/clikt/testing/CliktTesting.kt @@ -208,7 +208,11 @@ inline fun > BaseCliktCommand.test( configureContext { val originalReader = readEnvvar readEnvvar = { envvars[it] ?: (if (includeSystemEnvvars) originalReader(it) else null) } - terminal = Terminal(terminal.theme, terminal.tabWidth, recorder) + terminal = Terminal( + theme = terminal.theme, + tabWidth = terminal.tabWidth, + terminalInterface = recorder + ) } try { parse(argv) diff --git a/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/parameters/PromptOptionsTest.kt b/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/parameters/PromptOptionsTest.kt index 662e0387..e5d34224 100644 --- a/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/parameters/PromptOptionsTest.kt +++ b/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/parameters/PromptOptionsTest.kt @@ -11,6 +11,7 @@ import com.github.ajalt.clikt.testing.TestCommand import com.github.ajalt.clikt.testing.test import com.github.ajalt.mordant.terminal.ConversionResult import com.github.ajalt.mordant.terminal.YesNoPrompt +import com.github.ajalt.mordant.terminal.prompt import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain import kotlin.js.JsName diff --git a/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/testing/TestingUtilsTest.kt b/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/testing/TestingUtilsTest.kt index caf9b966..9ea23874 100644 --- a/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/testing/TestingUtilsTest.kt +++ b/clikt-mordant/src/commonTest/kotlin/com/github/ajalt/clikt/testing/TestingUtilsTest.kt @@ -78,13 +78,13 @@ class TestingUtilsTest { fun `test TerminalInfo configuration`() { class C : TestCommand() { override fun run_() { - with(currentContext.terminal.info) { - ansiLevel shouldBe AnsiLevel.NONE - width shouldBe 11 - height shouldBe 22 - ansiHyperLinks shouldBe true - outputInteractive shouldBe true - inputInteractive shouldBe true + with(currentContext.terminal) { + terminalInfo.ansiLevel shouldBe AnsiLevel.NONE + size.width shouldBe 11 + size.height shouldBe 22 + terminalInfo.ansiHyperLinks shouldBe true + terminalInfo.outputInteractive shouldBe true + terminalInfo.inputInteractive shouldBe true } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6e2a3dd8..8f30e169 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,11 @@ [versions] kotlin = "2.0.0" coroutines = "1.8.1" +mordant = "3.0.0" [libraries] -mordant = "com.github.ajalt.mordant:mordant:2.6.0" +mordant = {module = "com.github.ajalt.mordant:mordant", version.ref = "mordant"} +mordant-markdown = {module = "com.github.ajalt.mordant:mordant-markdown", version.ref = "mordant"} # used in tests coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }