EitherParser

case class EitherParser[T](underlying: Parser[T]) extends Parser[Either[Error, T]]
Companion:
object
trait Product
trait Equals
class Parser[Either[Error, T]]
trait ParserMethods[Either[Error, T]]
class Object
trait Matchable
class Any

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.

Value members

Concrete methods

def args: Seq[Arg]

Arguments this parser accepts.

Arguments this parser accepts.

Used to generate help / usage messages.

Definition Classes
ParserMethods
Definition Classes
ParserMethods
Definition Classes
ParserMethods
def get(d: D, nameFormatter: Formatter[Name]): Right[Error, 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

nameFormatter:

formats names to the appropriate format

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.

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

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 withUnderlying(underlying: Parser[T]): EitherParser[T]
Implicitly added by EitherParserWithOps

Inherited methods

def complete(args: Seq[String], index: Int, completer: Completer[Either[Error, T]], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): List[CompletionItem]
Inherited from:
ParserMethods
final def detailedParse(args: Seq[String], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): Either[Error, (T, RemainingArgs)]
Inherited from:
ParserMethods
final def detailedParse(args: Seq[String], stopAtFirstUnrecognized: Boolean): Either[Error, (T, RemainingArgs)]
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

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

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
Inherited from:
Parser
final def map[U](f: Either[Error, T] => U): Parser[U]
Inherited from:
Parser
Inherited from:
Parser
final def parse(args: Seq[String]): Either[Error, (T, Seq[String])]
Inherited from:
ParserMethods
Inherited from:
Product
final def scan(args: Seq[String], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): (Either[(Error, Either[D, T]), (T, RemainingArgs)], List[Step])
Inherited from:
ParserMethods
def step(args: List[String], index: Int, d: D): Either[(Error, Arg, List[String]), Option[(D, Arg, List[String])]]
Inherited from:
ParserMethods
Inherited from:
Parser
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.

Inherited from:
Parser