package parsing
- Alphabetic
- Public
- Protected
Type Members
- trait Arg[A] extends AnyRef
An arg represents a handle to a parameter's value.
- class ArgumentParser extends AnyRef
A simple command line argument parser.
A simple command line argument parser.
Usage
1. Define parameters with param, requiredParam and repeatedParam. Each of these methods gives back a handle to a future argument value.
2. Call
parse()
with actual arguments.3a. If parsing succeeds, the arguments will be available in the handles defined in step 1.
3b. If parsing fails, error descriptions are printed and the program exits with 2. (This behaviour may be changed by subclassing and redefining the
check()
method).Example
val parser = cmdr.ArgumentParser("appname", "0.1.0") val p1 = parser.param[String]("--this-is-a-named-param", "default value") val p2 = parser.param[Int]("positional-param", 2) parser.parse(Seq("--this-is-a-named-param=other", 5)) println(p1.get) println(p2.get)
- trait Reader[A] extends AnyRef
A typeclass that defines how to convert a string from a single command line argument to a given type.
A typeclass that defines how to convert a string from a single command line argument to a given type.
- Annotations
- @implicitNotFound("Don't know how to read a ${A} from a command line argument. Try implementing your own cmdr.parsing.Rader[$A].")
Value Members
- object ArgumentParser
- object Reader