diff --git a/README.md b/README.md index 3d0e8f3..3617c86 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,8 @@ Move the executable somewhere in your $PATH Or build a native image with GraalVM ```bash -./gradlew installShadowDist -cd app/build/install/app-shadow/lib -native-image --no-fallback -R:MaxNewSize=32 --language:js -jar scaffold.jar +./gradlew buildNative +cd app/build/native ``` ## Usage diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d3b9682..680a5de 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -22,3 +22,21 @@ tasks.withType { archiveClassifier.set("") archiveVersion.set("") } + +task("buildNative") { + dependsOn("installShadowDist") + + doLast { + exec { + commandLine( + "native-image", + "--no-fallback", + "-R:MaxNewSize=32", + "--language:js", + "-jar", + "${project.buildDir}/install/app-shadow/lib/scaffold.jar", + "${project.buildDir}/native/scaffold" + ) + } + } +} \ No newline at end of file diff --git a/app/src/commands/GenerateCommand.kt b/app/src/commands/GenerateCommand.kt index 2b4664e..2fa2856 100644 --- a/app/src/commands/GenerateCommand.kt +++ b/app/src/commands/GenerateCommand.kt @@ -46,7 +46,17 @@ class GenerateCommand(private val generators: Generators) : CliktCommand("genera null -> "[y/n]" } - return this@GenerateCommand.prompt("$text $suffix", default = "$default", showDefault = false) { + val defaultAsString = when (default) { + true -> "y" + false -> "n" + null -> null + } + + return this@GenerateCommand.prompt( + "$text $suffix", + default = defaultAsString, + showDefault = false + ) { when (it.toLowerCase()) { "y" -> true "n" -> false