mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
Non-options arguments are handled correctly in IRS Demo
This commit is contained in:
parent
8e9fc2d4c0
commit
626e8489e8
@ -71,8 +71,7 @@ fun main(args: Array<String>) {
|
|||||||
val fakeTradeWithAddr = parser.accepts("fake-trade-with-address").withOptionalArg()
|
val fakeTradeWithAddr = parser.accepts("fake-trade-with-address").withOptionalArg()
|
||||||
val fakeTradeWithIdentityFile = parser.accepts("fake-trade-with-identity-file").withOptionalArg()
|
val fakeTradeWithIdentityFile = parser.accepts("fake-trade-with-identity-file").withOptionalArg()
|
||||||
|
|
||||||
val tradeIdArg = parser.nonOptions("Trade ID")
|
val nonOptions = parser.nonOptions().ofType(String::class.java)
|
||||||
val dateArg = parser.nonOptions("Date")
|
|
||||||
|
|
||||||
val options = try {
|
val options = try {
|
||||||
parser.parse(*args)
|
parser.parse(*args)
|
||||||
@ -87,9 +86,9 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
val role = options.valueOf(roleArg)!!
|
val role = options.valueOf(roleArg)!!
|
||||||
if(role == IRSDemoRole.Trade) {
|
if(role == IRSDemoRole.Trade) {
|
||||||
val args : List<String> = options.valuesOf(tradeIdArg)
|
val tradeIdArgs = options.valuesOf(nonOptions)
|
||||||
if (args.size > 0) {
|
if (tradeIdArgs.size > 0) {
|
||||||
val tradeId = args[0]
|
val tradeId = tradeIdArgs[0]
|
||||||
if (runTrade(tradeId)) {
|
if (runTrade(tradeId)) {
|
||||||
exitProcess(0)
|
exitProcess(0)
|
||||||
} else {
|
} else {
|
||||||
@ -100,9 +99,9 @@ fun main(args: Array<String>) {
|
|||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
} else if(role == IRSDemoRole.Date) {
|
} else if(role == IRSDemoRole.Date) {
|
||||||
val args = options.valuesOf(dateArg)
|
val dateStrArgs = options.valuesOf(nonOptions)
|
||||||
if (args.size > 0) {
|
if (dateStrArgs.size > 0) {
|
||||||
val dateStr = args[0]
|
val dateStr = dateStrArgs[0]
|
||||||
runDateChange(dateStr)
|
runDateChange(dateStr)
|
||||||
} else {
|
} else {
|
||||||
println("Please provide a date")
|
println("Please provide a date")
|
||||||
|
Loading…
Reference in New Issue
Block a user