I get the above error running the following scala code with the single argument "-v":
import org.github.scopt._
object test {
def main(argv: Array[String]) {
var verbose = false
val parser = new OptionParser("scopt") {
booleanOpt("v", "verbose", "If true, be verbose", {v: Boolean => verbose = v})
}
if (!parser.parse(argv)) {
println("parser returned false")
}
println(if (verbose) "true" else "false")
}
}
java.lang.ArrayIndexOutOfBoundsException: 1
at scala.collection.mutable.WrappedArray$ofRef.apply(WrappedArray.scala:99)
at org.github.scopt.OptionParser.parse(Options.scala:437)
at test$.main(test.scala:12)
at test.main(test.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.Run.run0(Run.scala:60)
at sbt.Run.execute$1(Run.scala:47)
at sbt.Run$$anonfun$run$2.apply(Run.scala:50)
at sbt.Run$$anonfun$run$2.apply(Run.scala:50)
at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)
I'm running off the current master branch (compiled into my local ivy repo).