mirror of
https://github.com/apple/pkl.git
synced 2026-03-31 14:13:15 +02:00
Bump clikt to 5.0.3 (#947)
This bumps Clikt from version 3 to version 5, which, among other things, improves the help text formatting with colors. Also: * Add `--version` flag to pkldoc, pkl-codegen-java, pkl-codegen-kotlin * Add help text to pkldoc, pkl-codegen-java, pkl-codegen-kotlin
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package org.pkl.doc
|
||||
|
||||
import com.github.ajalt.clikt.core.main
|
||||
import com.github.ajalt.clikt.parameters.arguments.argument
|
||||
import com.github.ajalt.clikt.parameters.arguments.convert
|
||||
import com.github.ajalt.clikt.parameters.arguments.multiple
|
||||
@@ -31,6 +32,7 @@ import org.pkl.commons.cli.cliMain
|
||||
import org.pkl.commons.cli.commands.BaseCommand
|
||||
import org.pkl.commons.cli.commands.BaseOptions.Companion.parseModuleName
|
||||
import org.pkl.commons.cli.commands.ProjectOptions
|
||||
import org.pkl.commons.cli.commands.installCommonOptions
|
||||
import org.pkl.commons.cli.commands.single
|
||||
import org.pkl.core.Release
|
||||
|
||||
@@ -39,12 +41,12 @@ internal fun main(args: Array<String>) {
|
||||
cliMain { DocCommand().main(args) }
|
||||
}
|
||||
|
||||
class DocCommand :
|
||||
BaseCommand(name = "pkldoc", helpLink = Release.current().documentation().homepage()) {
|
||||
val helpLink = "${Release.current().documentation.homepage}pkl-doc/index.html#cli"
|
||||
|
||||
class DocCommand : BaseCommand(name = "pkldoc", helpLink = helpLink) {
|
||||
private val modules: List<URI> by
|
||||
argument(
|
||||
name = "<modules>",
|
||||
name = "modules",
|
||||
help = "Module paths/uris, or package uris to generate documentation for",
|
||||
)
|
||||
.convert { parseModuleName(it) }
|
||||
@@ -53,7 +55,7 @@ class DocCommand :
|
||||
private val outputDir: Path by
|
||||
option(
|
||||
names = arrayOf("-o", "--output-dir"),
|
||||
metavar = "<directory>",
|
||||
metavar = "directory",
|
||||
help = "Directory where generated documentation is placed.",
|
||||
)
|
||||
.path()
|
||||
@@ -69,6 +71,8 @@ class DocCommand :
|
||||
|
||||
private val projectOptions by ProjectOptions()
|
||||
|
||||
override val helpString: String = "Generate HTML documentation from Pkl modules and packages."
|
||||
|
||||
override fun run() {
|
||||
val options =
|
||||
CliDocGeneratorOptions(
|
||||
@@ -79,4 +83,8 @@ class DocCommand :
|
||||
)
|
||||
CliDocGenerator(options).run()
|
||||
}
|
||||
|
||||
init {
|
||||
installCommonOptions()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.pkl.doc
|
||||
|
||||
import com.github.ajalt.clikt.core.parse
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
|
||||
Reference in New Issue
Block a user