I'm trying to have a base option parser with some default parameters.
In other projects i would like to extend the option parser with other parameters.
Something like:
case class Config(foo: String = null)
trait DefaultParser { self: OptionParser[Config] =>
opt[String]('f', "foo") action { (x, c) =>
c.copy(foo = x)
}
}
case class MyConfig(bar: String = "hello world")
trait MyParser { self: OptionParser[MyConfig] =>
opt[String]('b', "bar") action { (x, c) =>
c.copy(bar = x)
}
}
I'm a newbie at Scala
and I'm not sure how I can now use both of them on the same args
.
I'm using Scala
2.10 with scopt_2.10
v3.3.0.