All Downloads are FREE. Search and download functionalities are using the official Maven repository.

application.SpecmaticApplicationRunner.kt Maven / Gradle / Ivy

There is a newer version: 2.0.37
Show newest version
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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy