From 6da1a702bff1c482f2f9c93ccade80c47afba4f0 Mon Sep 17 00:00:00 2001 From: Andras Slemmer <andras.slemmer@r3cev.com> Date: Mon, 11 Jul 2016 15:58:17 +0100 Subject: [PATCH] irsdemo: Give descriptions of cli arguments --- src/main/kotlin/com/r3corda/demos/IRSDemo.kt | 30 ++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt index a3e5a1321f..2fc92bd0be 100644 --- a/src/main/kotlin/com/r3corda/demos/IRSDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/IRSDemo.kt @@ -224,13 +224,26 @@ enum class IRSDemoNode { object CliParamsSpec { val parser = OptionParser() - val roleArg = parser.accepts("role").withRequiredArg().ofType(IRSDemoRole::class.java) - val networkAddressArg = parser.accepts("network-address").withOptionalArg().ofType(String::class.java) - val apiAddressArg = parser.accepts("api-address").withOptionalArg().ofType(String::class.java) - val baseDirectoryArg = parser.accepts("base-directory").withOptionalArg().defaultsTo(CliParams.defaultBaseDirectory) - val networkMapIdentityFile = parser.accepts("network-map-identity-file").withOptionalArg() - val networkMapNetAddr = parser.accepts("network-map-address").withRequiredArg().defaultsTo("localhost") - val fakeTradeWithIdentityFile = parser.accepts("fake-trade-with-identity-file").withOptionalArg() + val roleArg = parser.accepts("role") + .withRequiredArg().ofType(IRSDemoRole::class.java) + val networkAddressArg = + parser.accepts("network-address", "The p2p networking address to use") + .withOptionalArg().ofType(String::class.java) + val apiAddressArg = + parser.accepts("api-address", "The address to expose the HTTP API on") + .withOptionalArg().ofType(String::class.java) + val baseDirectoryArg = + parser.accepts("base-directory", "The directory to put all files under") + .withOptionalArg().defaultsTo(CliParams.defaultBaseDirectory) + val networkMapIdentityFile = + parser.accepts("network-map-identity-file", "The file containing the Party info of the network map") + .withOptionalArg() + val networkMapNetAddr = + parser.accepts("network-map-address", "The address of the network map") + .withRequiredArg().defaultsTo("localhost") + val fakeTradeWithIdentityFile = + parser.accepts("fake-trade-with-identity-file", "Extra identities to be registered with the identity service") + .withOptionalArg() val nonOptions = parser.nonOptions() } @@ -453,8 +466,9 @@ private fun createDefaultConfigFile(configFile: File, legalName: String) { } private fun printHelp(parser: OptionParser) { + val roleList = IRSDemoRole.values().joinToString(separator = "|") {it.toString()} println(""" - Usage: irsdemo --role [NodeA|NodeB|Trade|Date] [<TradeName>|<DateValue>] [options] + Usage: irsdemo --role $roleList [<TradeName>|<DateValue>] [options] Please refer to the documentation in docs/build/index.html for more info. """.trimIndent())