0

I am currently using scopt for a Command Line Application. However My scopt.OptionParser[Config] is getting very large. I was thinking it might be nice to break it into smaller parts, and then combine them.

After reading the documentation I don't see any way of doing that.

Did I miss something? Or is it not possible?

Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319
Nicholas Marshall
  • 2,981
  • 2
  • 26
  • 22

1 Answers1

1

Yes it can be broken into smaller chunks. You can do it by moving functionality into traits something like:

trait FooParser { self: OptionParser[MyArgs] =>
  cmd("foo")
  ...
}
trait BarParser { self: OptionParser[MyArgs] =>
  cmd("bar")
  ...
}
val fooBarParser = new OptionParser[MyArgs]("FooBar") with FooParser with BarParser {
  head("FooBar")
  ...
}
Wade
  • 346
  • 2
  • 12