-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from InkApplications/module-refactor
Break CLI into seperate module
- Loading branch information
Showing
25 changed files
with
84 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
application | ||
kotlin("jvm") | ||
} | ||
|
||
application { | ||
applicationName = "inkui" | ||
mainClass.set("ink.ui.cli.MainKt") | ||
} | ||
|
||
dependencies { | ||
implementation(projects.renderStaticHtml) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ink.ui.cli | ||
|
||
import ink.ui.render.statichtml.InkUiScript | ||
import java.io.File | ||
import kotlin.script.experimental.api.ScriptDiagnostic | ||
import kotlin.script.experimental.api.onFailure | ||
import kotlin.script.experimental.api.valueOrThrow | ||
import kotlin.system.exitProcess | ||
|
||
fun main(args: Array<String>) { | ||
val file = args.firstOrNull() | ||
?.let(::File) | ||
?: run { | ||
println("Usage: render-ui <file>") | ||
exitProcess(1) | ||
} | ||
InkUiScript.evalFile(file) | ||
.onFailure { result -> | ||
result.reports | ||
.filter { it.severity > ScriptDiagnostic.Severity.INFO } | ||
.forEach { | ||
println(it.message) | ||
it.exception?.printStackTrace() | ||
} | ||
exitProcess(1) | ||
} | ||
.valueOrThrow() | ||
.returnValue | ||
.scriptInstance | ||
.let { it as InkUiScript } | ||
.run { | ||
print(getHtml()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
plugins { | ||
application | ||
kotlin("jvm") | ||
kotlin("multiplatform") | ||
id("ink.publishing") | ||
} | ||
|
||
application { | ||
applicationName = "render-ui" | ||
mainClass.set("ink.ui.render.statichtml.MainKt") | ||
} | ||
|
||
dependencies { | ||
implementation(libs.kotlinx.coroutines.core) | ||
implementation(libs.kotlin.scripting.common) | ||
implementation(libs.kotlin.scripting.jvm.core) | ||
implementation(libs.kotlin.scripting.jvm.host) | ||
implementation(libs.kotlinx.html) | ||
api(projects.structures) | ||
implementation(projects.renderWebCommon) | ||
kotlin { | ||
jvmToolchain(11) | ||
jvm() | ||
sourceSets { | ||
jvmMain.dependencies { | ||
implementation(libs.kotlinx.coroutines.core) | ||
api(libs.kotlin.scripting.common) | ||
implementation(libs.kotlin.scripting.jvm.core) | ||
implementation(libs.kotlin.scripting.jvm.host) | ||
implementation(libs.kotlinx.html) | ||
api(projects.structures) | ||
implementation(projects.renderWebCommon) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters