MappedParser

caseapp.core.parser.MappedParser
See theMappedParser companion object
case class MappedParser[T, U](underlying: Parser[T], f: T => U) extends Parser[U]

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Parser[U]
trait ParserMethods[U]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

type D = D

Intermediate result type.

Intermediate result type.

Used during parsing, while checking the arguments one after the other.

If parsing succeeds, a T can be built from the D at the end of parsing.

Attributes

Value members

Concrete methods

def args: Seq[Arg]

Arguments this parser accepts.

Arguments this parser accepts.

Used to generate help / usage messages.

Attributes

override def defaultIgnoreUnrecognized: Boolean

Attributes

Definition Classes
ParserMethods

Attributes

Definition Classes
ParserMethods
override def defaultStopAtFirstUnrecognized: Boolean

Attributes

Definition Classes
ParserMethods
def get(d: D, nameFormatter: Formatter[Name]): Either[Error, U]

Get the final result from the final intermediate value.

Get the final result from the final intermediate value.

Typically fails if some mandatory arguments were not specified, so are missing in d, preventing building a T out of it.

Value parameters

d:

final intermediate value

nameFormatter:

formats names to the appropriate format

Attributes

Returns

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

def init: D

Initial value used to accumulate parsed arguments.

Initial value used to accumulate parsed arguments.

Attributes

def step(args: List[String], index: Int, d: D, nameFormatter: Formatter[Name]): Either[(Error, Arg, List[String]), Option[(D, Arg, List[String])]]

Process the next argument.

Process the next argument.

If some arguments were successfully processed (third case in return below), the returned remaining argument sequence must be shorter than the passed args.

This method doesn't fully process args. It tries just to parse one argument (typically one option --foo and its value bar, so two elements from args - it can also be only one element in case of a flag), if possible. If you want to fully process a sequence of arguments, see parse or detailedParse.

Value parameters

args:

arguments to process

d:

current intermediate result

nameFormatter:

formats name to the appropriate format

Attributes

Returns

if no argument were parsed, Right(None); if an error occurred, an error message wrapped in caseapp.core.Error and scala.Left; else the next intermediate value and the remaining arguments wrapped in scala.Some and scala.Right.

def withDefaultOrigin(origin: String): Parser[U]
def withUnderlying(underlying: Parser[T]): MappedParser[T, U]
Implicitly added by MappedParserWithOps

Inherited methods

def complete(args: Seq[String], index: Int, completer: Completer[U], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): List[CompletionItem]

Attributes

Inherited from:
ParserMethods
final def detailedParse(args: Seq[String], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): Either[Error, (T, RemainingArgs)]

Attributes

Inherited from:
ParserMethods
final def detailedParse(args: Seq[String], stopAtFirstUnrecognized: Boolean): Either[Error, (T, RemainingArgs)]

Attributes

Inherited from:
ParserMethods
final def detailedParse(args: Seq[String]): Either[Error, (T, RemainingArgs)]

Keeps the remaining args before and after a possible -- separated

Keeps the remaining args before and after a possible -- separated

Attributes

Inherited from:
ParserMethods
final def get(d: D): Either[Error, T]

Get the final result from the final intermediate value.

Get the final result from the final intermediate value.

Typically fails if some mandatory arguments were not specified, so are missing in d, preventing building a T out of it.

Value parameters

d:

final intermediate value

Attributes

Returns

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

Inherited from:
ParserMethods

Attributes

Inherited from:
Parser
final def map[U](f: U => U): Parser[U]

Attributes

Inherited from:
Parser

Attributes

Inherited from:
Parser
final def parse(args: Seq[String]): Either[Error, (T, Seq[String])]

Attributes

Inherited from:
ParserMethods
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
final def scan(args: Seq[String], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): (Either[(Error, Either[D, T]), T], RemainingArgs, List[Step])

Attributes

Inherited from:
ParserMethods
def step(args: List[String], index: Int, d: D): Either[(Error, Arg, List[String]), Option[(D, Arg, List[String])]]

Attributes

Inherited from:
ParserMethods

Attributes

Inherited from:
Parser

Attributes

Inherited from:
Parser
final def withHelp: Parser[WithHelp[T]]

Creates a Parser accepting help / usage arguments, out of this one.

Creates a Parser accepting help / usage arguments, out of this one.

Attributes

Inherited from:
Parser