I need to pass multiple arguments into a scala program from the command line. The first one is the database, the second one is the table and the third one needs to be a map where the Map can have from 1 to n combinations of (String, Int). My script would then be executed like this:
$ scala script.scala dbame tablename Map(("score100", 20), ("score200", 10))
How do I pass that Map to the fields variable in my script (see code below)?
val database = args.length match {
case x:Int if x>0 => args(0)
case _ => {
println("error")
System.exit(1)
}
}
val table = args.length match {
case x:Int if x>1 => args(1)
case _ => {
println("error")
System.exit(1)
}
}
val fields = args.length match {
case x:Int if x>2 => args(2)
case _ => {
println("error")
System.exit(1)
}
}