1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
### string short options
scopt 3.0 changed short options from `String` to `Char` to enforce all short options to be a single character. In scopt 3.1 `opt` still uses `Char`, but using `abbr("nk")` it supports `String` short options:
val parser = new scopt.OptionParser[Config]("scopt") {
head("scopt", "3.x")
opt[Unit]('n', "netrc")
opt[Unit]('k', "keepalive") action { (x, c) =>
c.copy(keepalive= true) }
opt[Unit]("no-keepalive") abbr("nk") action { (x, c) =>
c.copy(keepalive = false) }
}
Grouped options are parsed greedily. For example, in the above `-nk` is parsed as `--no-keepalive`; and `-nknk` is parsed as `--no-keepalive --netrc --keepalive`. [#19][19]
### bug fixes and minor enhancements
- Uses `Console.err` instead of `System.err` [#18][18] contributed by [@kxbmap][@kxbmap].
[18]: https://github.com/scopt/scopt/pull/18
[19]: https://github.com/scopt/scopt/issues/19
[@kxbmap]: https://github.com/kxbmap
|