Scopt v3.2.0 Release Notes

Release Date: 2016-06-12 // almost 8 years ago
  • ๐Ÿ’ฅ 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 requested by @tksk.

    ๐Ÿ–จ usage text prints to Console.out

    ๐Ÿ–จ Usage text will print to Console.out instead of Console.err when invoked as --help. #24 reported by @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 contributed by @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 requested by @zero-sum.