File: 3.3.0.markdown

package info (click to toggle)
scopt 3.5.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 312 kB
  • sloc: xml: 45; makefile: 13
file content (19 lines) | stat: -rw-r--r-- 800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  [56]: https://github.com/scopt/scopt/pull/56
  [@melrief]: https://github.com/melrief


## comma-separated values

scopt 3.3.0 adds support for comma-separated values that map to `Seq[A]` and `Map[K, V]` (where `A`, `K` and `V` are instance of `Read`).

- A `Seq[File]` accepts a string containing comma-separated values such as `--jars foo.jar,bar.jar`
- A `Map[String, String]` accepts a string containing comma-separated pairs like `--kwargs key1=val1,key2=val2`

Here's how they can be used:

    opt[Seq[File]]('j', "jars") valueName("<jar1>,<jar2>...") action { (x,c) =>
      c.copy(jars = x) } text("jars to include")
    opt[Map[String,String]]("kwargs") valueName("k1=v1,k2=v2...") action { (x, c) =>
      c.copy(kwargs = x) } text("other arguments")

[#56][56] by [@melrief][@melrief].