ValueConverter

trait ValueConverter[A]

Converter from list of plain strings to something meaningful.

Converter from list of plain strings to something meaningful.

class Object
trait Matchable
class Any

Value members

Abstract methods

def parse(s: List[(String, List[String])]): Either[String, Option[A]]

Takes a list of arguments to all option invocations: for example, "-a 1 2 -a 3 4 5" would produce List(("a",List(1,2)),("a",List(3,4,5))).

Takes a list of arguments to all option invocations: for example, "-a 1 2 -a 3 4 5" would produce List(("a",List(1,2)),("a",List(3,4,5))).

  • parse returns Left, if there was an error while parsing.

  • if no option was found, it returns Right(None).

  • if option was found, it returns Right(...).

Concrete methods

def argFormat(name: String): String

Transformation of argument name to argument definition in help.

Transformation of argument name to argument definition in help.

def flatMap[B](fn: A => Either[String, Option[B]]): ValueConverter[B]

Map the converter to another value. This method is different from .map because it can return an error (without resorting to exceptions, returning Left(msg)) or can filter out unsupported values (by returning Right(None)).

Map the converter to another value. This method is different from .map because it can return an error (without resorting to exceptions, returning Left(msg)) or can filter out unsupported values (by returning Right(None)).

def map[B](fn: A => B): ValueConverter[B]

Maps the converter to another value:

Maps the converter to another value:

intConverter.map(_+2) // and you get a "biased converter"
def parseCached(s: List[(String, List[String])]): Either[String, Option[A]]

Abstract fields

val argType: V

Type of parsed argument list.

Type of parsed argument list.