application.SpecmaticApplicationRunner.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of specmatic-executable Show documentation
Show all versions of specmatic-executable Show documentation
Command-line standalone executable jar for Specmatic
package application
import org.springframework.boot.CommandLineRunner
import org.springframework.boot.ExitCodeGenerator
import org.springframework.stereotype.Component
import picocli.CommandLine
@Component
class SpecmaticApplicationRunner(specmaticCommand: SpecmaticCommand, private val factory: CommandLine.IFactory) : CommandLineRunner, ExitCodeGenerator {
private val myCommand: SpecmaticCommand = specmaticCommand
private var exitCode = 0
@Throws(Exception::class)
override fun run(vararg args: String) {
val cmd = CommandLine(myCommand, factory)
cmd.subcommands.getValue("generate-completion").commandSpec.usageMessage().hidden(true)
exitCode = cmd.execute(*args)
}
override fun getExitCode() = exitCode
}