Avenger
Avenger

Reputation: 877

Scopt for complex types

import scopt.Read.stringRead._
case class Config(
    kwargs: Map[String, Map[String, List[String]]] = Map()
)

  val parser: OptionParser[Config] = new scopt.OptionParser[Config]("test") {
    head("Test Server", "v1")
   
    opt[Map[String, Map[String, List[String]]]]("kwargs")
      .valueName("k1=v1,k2=v2...")
      .action((x, c) => c.copy(kwargs = x))
      .text("other arguments")

What would be the value name and text for it? k1=v1,k2=v2... is valid for map of string.


       .valueName(???)
          .action((x, c) => ??)
          .text("other arguments")

Upvotes: 0

Views: 200

Answers (0)

Related Questions