abstract
class
CmdOpts[T] extends AnyRef
Instance Constructors
-
new
CmdOpts(rawdata: Seq[T])
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
check[R](xopt: Option[R], err: String): ValidationNel[String, R]
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
handleErrors(xs: NonEmptyList[String]): Unit
-
def
handleInfo(): Unit
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
opt[H <: HList, N <: Nat, F, R](t: T, f: F)(implicit hlister: shapeless.ops.function.FnToProduct.Aux[F, (H) ⇒ R], length: Aux[H, N], toHList: FromTraversable[H], size: ToInt[N]): Option[R]
-
val
startup: Option[Unit]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
def
usage: Option[String]
-
-
def
version: Option[String]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
This class implements a simple but type-safe command-line option parser.
You will generally use this by declaring an object that extends CmdOpts and passing in args (the array of cmd-line String arguments).
You then ask for the specific options by calling 'opt' with the String for the option name, and a function that takes the next n Strings and returns a thing of the type you want. If the arguments are found they are passed to the function and the result is returned inside a Some, if they cannot be found or an exception is thrown from the function, a None is returned.
Validation error messages can be specified by implementing the validate method.
Usage and Version messages can be specified by implementing the usage and version methods respectively.
Example.scala