CORDA-2623 - Add help screen to Network Builder CLI tool (#4775)

This commit is contained in:
Tommy Lillehagen 2019-02-17 16:33:08 +00:00 committed by GitHub
parent e0121f52ac
commit f781edccd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -22,6 +22,11 @@ fun main(args: Array<String>) {
CommandLine(baseArgs).parse(*args) CommandLine(baseArgs).parse(*args)
testDockerConnectivity() testDockerConnectivity()
if (baseArgs.usageHelpRequested) {
CommandLine.usage(CliParser(), System.out)
return
}
if (baseArgs.gui) { if (baseArgs.gui) {
Application.launch(Gui::class.java) Application.launch(Gui::class.java)
return return

View File

@ -17,13 +17,15 @@ open class CliParser {
@Option(names = ["-d", "--nodes-directory"], description = ["The directory to search for nodes in"]) @Option(names = ["-d", "--nodes-directory"], description = ["The directory to search for nodes in"])
var baseDirectory = File(System.getProperty("user.dir")) var baseDirectory = File(System.getProperty("user.dir"))
@Option(names = ["-b", "--backend"], description = ["The backend to use when instantiating nodes"]) @Option(names = ["-b", "--backend"], description = ["The backend to use when instantiating nodes. Valid values: LOCAL_DOCKER and AZURE."])
var backendType: Backend.BackendType = Backend.BackendType.LOCAL_DOCKER var backendType: Backend.BackendType = Backend.BackendType.LOCAL_DOCKER
@Option(names = ["--add"], split = ":", description = ["The node to add. Format is <Name>:<X500>. Eg; \"Node1:O=Bank A, L=New York, C=US, OU=Org Unit, CN=Service Name\""]) @Option(names = ["--add"], split = ":", description = ["The node to add. Format is <Name>:<X500>. Eg; \"Node1:O=Bank A, L=New York, C=US, OU=Org Unit, CN=Service Name\""])
var nodesToAdd: MutableMap<String, String> = hashMapOf() var nodesToAdd: MutableMap<String, String> = hashMapOf()
@Option(names = ["-h", "--help"], usageHelp = true, description = ["Display this help message"])
var usageHelpRequested: Boolean = false
fun isNew(): Boolean { fun isNew(): Boolean {
return nodesToAdd.isEmpty() return nodesToAdd.isEmpty()
} }
@ -50,4 +52,4 @@ class AzureParser : CliParser() {
override fun backendOptions(): Map<String, String> { override fun backendOptions(): Map<String, String> {
return mapOf(Constants.REGION_ARG_NAME to region.name()) return mapOf(Constants.REGION_ARG_NAME to region.name())
} }
} }