SimpleArgParser

caseapp.core.argparser.SimpleArgParser
See theSimpleArgParser companion object
case class SimpleArgParser[T](description: String, parse: (String, Int, Int) => Either[Error, T]) extends ArgParser[T]

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class ArgParser[T]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def apply(current: Option[T], index: Int, span: Int, value: String): Either[Error, T]

Parses a value.

Parses a value.

value must be consumed. Corresponds to cases like --foo=bar.

Value parameters

current:

latest parsed value wrapped in scala.Some if any, scala.None else

value:

scala.Predef.String to parse

Attributes

Returns

in case of success, a T, wrapped in scala.Right; else, and error message, wrapped in caseapp.core.Error and scala.Left

Inherited methods

def apply(current: Option[T], index: Int): Either[Error, T]

Called when the corresponding argument was specified with no value.

Called when the corresponding argument was specified with no value.

Can happen if the option was enabled as very last argument, like --bar in --foo 1 other --bar.

Value parameters

current:

latest parsed value wrapped in scala.Some if any, scala.None else

Attributes

Returns

a T wrapped in scala.Right in case of success, or an error message wrapped in caseapp.core.Error and scala.Left else

Inherited from:
ArgParser
def isFlag: Boolean

Whether the parsed value corresponds to a flag.

Whether the parsed value corresponds to a flag.

Prevents telling corresponding arguments expect a value in help messages.

Attributes

Inherited from:
ArgParser
def optional(current: Option[T], index: Int, span: Int, value: String): (Consumed, Either[Error, T])

Parses a value.

Parses a value.

Unlike apply above, value may or may not be consumed. Corresponds to cases like --foo bar.

Use of value or not must be returned via the caseapp.core.argparser.Consumed value.

Value parameters

current:

latest parsed value wrapped in scala.Some if any, scala.None else

value:

scala.Predef.String to parse

Attributes

Returns

in case of success, whether value was consumed and a T, wrapped in scala.Right; else, and error message, wrapped in caseapp.core.Error and scala.Left

Inherited from:
ArgParser
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
final def xmap[U](from: U => T, to: T => U): ArgParser[U]

Attributes

Inherited from:
ArgParser
final def xmapError[U](from: U => T, to: T => Either[Error, U]): ArgParser[U]

Attributes

Inherited from:
ArgParser