Skip to content

Commit

Permalink
Add a basic sample to show information for issue reports
Browse files Browse the repository at this point in the history
Later on printing of selected environment variables or similar useful
output could be added.
  • Loading branch information
sschuberth committed Sep 18, 2023
1 parent edffaba commit 046ad77
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/detection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Detection Sample

This sample shows the detected terminal, e.g. to collect information for issue reports.
35 changes: 35 additions & 0 deletions samples/detection/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

plugins {
kotlin("multiplatform")
application
}

kotlin {
jvm {
withJava()
}

macosX64()
linuxX64()
mingwX64()

targets.filterIsInstance<KotlinNativeTarget>().forEach { target ->
target.binaries.executable {
entryPoint = "com.github.ajalt.mordant.samples.main"
}
}

sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":mordant"))
}
}
}
}

application {
mainClass.set("com.github.ajalt.mordant.samples.MainKt")
applicationDefaultJvmArgs = listOf("-Dfile.encoding=utf-8")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.github.ajalt.mordant.samples

import com.github.ajalt.mordant.rendering.Theme
import com.github.ajalt.mordant.terminal.Terminal

fun main() {
val terminal = Terminal()
terminal.println(Theme.Default.info(terminal.info.toString()))
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include("mordant")
include("samples:detection")
include("samples:markdown")
include("samples:progress")
include("samples:table")
Expand Down

0 comments on commit 046ad77

Please sign in to comment.