1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
[21]: https://github.com/scopt/scopt/pull/21
[22]: https://github.com/scopt/scopt/issues/22
[24]: https://github.com/scopt/scopt/issues/24
[27]: https://github.com/scopt/scopt/issues/27
[@zero-sum]: https://github.com/zero-sum
[@tksk]: https://github.com/tksk
[@Ceilican]: https://github.com/Ceilican
## breaking changes
### shorter error message
Instead of printing a wall of usage text on error, if `help("help")` option is defined, scopt 3.2.0 prints just the error message and suggests to "Try --help for more information."
This behavior can be reverted by overriding `showUsageOnError`.
[#22][22] requested by [@tksk][@tksk].
### usage text prints to `Console.out`
Usage text will print to `Console.out` instead of `Console.err` when invoked as `--help`. [#24][24] reported by [@Ceilican][@Ceilican].
## new features
### hidden options
opt can now be `hidden()`.
opt[Unit]("debug") hidden() action { (_, c) =>
c.copy(debug = true) } text("this option is hidden in the usage text")
[#21][21] contributed by [@tksk][@tksk].
### check configuration
To check consistency among the provided `opt` values, scopt 3.2.0 introduces `checkConfig`.
val parser = new scopt.OptionParser[Config]("scopt") {
head("scopt", "3.x")
opt[Unit]('k', "keepalive") action { (x, c) =>
c.copy(keepalive= true) }
opt[Boolean]("xyz") action { (x, c) =>
c.copy(xyz = x) } text("xyz is a boolean property"),
checkConfig { c =>
if (c.keepalive && c.xyz) failure("xyz cannot keep alive") else success }
help("help") text("prints this usage text")
}
[#27][27] requested by [@zero-sum][@zero-sum].
|