mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Make commands classes instead of objects (#946)
Making these classes caused native-image to statically initialize them at build time, which included CLI argument default values (like working dir). This turns them back into classes. Co-authored-by: Islon Scherer <islonscherer@gmail.com>
This commit is contained in:
@@ -34,10 +34,10 @@ import org.pkl.core.Release
|
||||
|
||||
/** Main method for the Pkldoc CLI. */
|
||||
internal fun main(args: Array<String>) {
|
||||
cliMain { DocCommand.main(args) }
|
||||
cliMain { DocCommand().main(args) }
|
||||
}
|
||||
|
||||
object DocCommand :
|
||||
class DocCommand :
|
||||
BaseCommand(name = "pkldoc", helpLink = Release.current().documentation().homepage()) {
|
||||
|
||||
private val modules: List<URI> by
|
||||
|
||||
@@ -23,7 +23,8 @@ import org.pkl.commons.cli.CliException
|
||||
class CliMainTest {
|
||||
@Test
|
||||
fun `CLI run test`() {
|
||||
val e = assertThrows<CliException> { DocCommand.parse(arrayOf("foo", "--output-dir", "/tmp")) }
|
||||
val e =
|
||||
assertThrows<CliException> { DocCommand().parse(arrayOf("foo", "--output-dir", "/tmp")) }
|
||||
assertThat(e)
|
||||
.hasMessageContaining("must contain at least one module named `doc-package-info.pkl`")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user