A small state-monad-based command line parser library written in scala.
libraryDependencies += "de.lhns" %% "scala-commandline" % "0.4.0"case class Options(help: Boolean, version: Boolean, logLevel: Option[String], decode: Boolean, validate: Boolean, params: Seq[String]) def main(args: Array[String]): Unit = { val options: Options = CommandLine(args) { for { default <- CommandLine.defaultOpts() /* shorthand for: empty <- CommandLine.isEmpty help <- CommandLine.opt("-h", "--help").flag version <- CommandLine.opt("--version").flag */ logLevel <- CommandLine.opt("--loglevel").arg.map(_.lastOption) decode <- CommandLine.opt("-d", "--decode").flag validate <- CommandLine.opt("--validate").flag _ <- CommandLine.errorOnUnrecognizedOpts() params <- CommandLine.args } yield Options( help = default.empty || default.help, version = default.version, logLevel = logLevel, decode = decode, validate = validate, params = params ) } }This project uses the Apache 2.0 License. See the file called LICENSE.