UI improvements, CLI fallbacks
This commit is contained in:
@@ -8,7 +8,22 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.jaytux.phoebench"
|
||||
version = rootProject.version.toString()
|
||||
version = "1.0.1"
|
||||
|
||||
val versionDirectory = layout.buildDirectory.dir("generated/sources/version")
|
||||
val generateVersion = tasks.register<Task>("serverVersion") {
|
||||
doFirst {
|
||||
val outFile = versionDirectory.get().file("com/jaytux/phoebench/client/cli/Version.kt").asFile
|
||||
outFile.parentFile.mkdirs()
|
||||
outFile.writeText("""
|
||||
package com.jaytux.phoebench.client.cli
|
||||
|
||||
object CliVersion {
|
||||
const val VERSION="${rootProject.version}"
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib"))
|
||||
@@ -42,6 +57,18 @@ kotlin {
|
||||
freeCompilerArgs.add("-Xcontext-parameters")
|
||||
optIn.add("kotlin.uuid.ExperimentalUuidApi")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val main by getting {
|
||||
kotlin {
|
||||
srcDir(versionDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.compileKotlin {
|
||||
dependsOn(generateVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<ShadowJar> {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.github.ajalt.clikt.parameters.groups.single
|
||||
import com.github.ajalt.clikt.parameters.options.*
|
||||
import com.github.ajalt.clikt.parameters.types.float
|
||||
import com.github.ajalt.clikt.parameters.types.inputStream
|
||||
import com.jaytux.phoebench.client.cli.CliVersion
|
||||
import com.jaytux.phoebench.common.TimeUnit
|
||||
import io.ktor.util.reflect.*
|
||||
import io.ktor.utils.io.*
|
||||
@@ -23,6 +24,10 @@ object CLI {
|
||||
help = "Disable all interactive input (makes arguments marked with (*) mandatory)"
|
||||
).flag(default = false)
|
||||
|
||||
init {
|
||||
versionOption(CliVersion.VERSION)
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
val sub = currentContext.invokedSubcommand
|
||||
if(sub == null) {
|
||||
@@ -208,6 +213,13 @@ object CLI {
|
||||
override fun run() = ProjectHandlers.newData(parent.finder, version, warmup, measurement, unit, input, hardware)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
class Version : CliktCommand(name = "version") {
|
||||
override fun run() {
|
||||
echo("phoebench-cli version ${CliVersion.VERSION}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
Reference in New Issue
Block a user