Parser

caseapp.core.parser.Parser
See theParser companion object
abstract class Parser[+T] extends ParserMethods[T]

Parses arguments, resulting in a T in case of success.

Type parameters

T:

success result type

Attributes

Companion
object
Graph
Supertypes
trait ParserMethods[T]
class Object
trait Matchable
class Any
Known subtypes
class ConsParser[H, T]
class EitherParser[T]
class MappedParser[T, U]
object NilParser
class OptionParser[T]
class RecursiveConsParser[H, T]
Show all

Members list

Type members

Types

type D <: Tuple
Implicitly added by either

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

type D <: Tuple
Implicitly added by option

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

type D <: Tuple

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

Abstract methods

def withDefaultOrigin(origin: String): Parser[T]
Implicitly added by either
def withDefaultOrigin(origin: String): Parser[T]
Implicitly added by option
def withDefaultOrigin(origin: String): Parser[T]

Concrete methods

def add[H : ArgParser](name: String, default: => Option[H], extraNames: Seq[Name], valueDescription: Option[ValueDescription], helpMessage: Option[HelpMessage], noHelp: Boolean, isFlag: Boolean, formatter: Formatter[Name]): Parser[H *: T]
Implicitly added by toParserOps
def addAll[H](using headParser: Parser[H]): Parser[H *: T]
Implicitly added by toParserOps
def as[F](using m: ProductOf[F], ev: T =:= Reverse[m.MirroredElemTypes], ev0: Reverse[Reverse[m.MirroredElemTypes]] =:= m.MirroredElemTypes): Parser[F]
Implicitly added by toParserOps
Implicitly added by either
Implicitly added by option
final def map[U](f: T => U): Parser[U]
Implicitly added by either
final def map[U](f: T => U): Parser[U]
Implicitly added by option
final def map[U](f: T => U): Parser[U]
def nameFormatter(f: Formatter[Name]): Parser[T]
Implicitly added by either
def nameFormatter(f: Formatter[Name]): Parser[T]
Implicitly added by option
def nameFormatter(f: Formatter[Name]): Parser[T]
Implicitly added by either
Implicitly added by option
def to[F](using m: ProductOf[F], ev: T =:= m.MirroredElemTypes): Parser[F]
Implicitly added by toParserOps
def toTuple[P <: Tuple](using m: ProductOf[T] { type MirroredElemTypes = P; }): Parser[P]
Implicitly added by toParserOps
def tupled: Parser[Reverse[T]]
Implicitly added by toParserOps
Implicitly added by either
Implicitly added by option
final def withHelp: Parser[WithHelp[T]]
Implicitly added by either

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

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

Attributes

final def withHelp: Parser[WithHelp[T]]
Implicitly added by option

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

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

Attributes

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 methods

def complete(args: Seq[String], index: Int, completer: Completer[T], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): List[CompletionItem]
Implicitly added by either

Attributes

Inherited from:
ParserMethods
def complete(args: Seq[String], index: Int, completer: Completer[T], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): List[CompletionItem]
Implicitly added by option

Attributes

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

Attributes

Inherited from:
ParserMethods
Implicitly added by either

Attributes

Inherited from:
ParserMethods
Implicitly added by option

Attributes

Inherited from:
ParserMethods

Attributes

Inherited from:
ParserMethods
Implicitly added by either

Attributes

Inherited from:
ParserMethods
Implicitly added by option

Attributes

Inherited from:
ParserMethods

Attributes

Inherited from:
ParserMethods
Implicitly added by either

Attributes

Inherited from:
ParserMethods
Implicitly added by option

Attributes

Inherited from:
ParserMethods

Attributes

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

Attributes

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

Attributes

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

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 detailedParse(args: Seq[String], stopAtFirstUnrecognized: Boolean, ignoreUnrecognized: Boolean): Either[Error, (T, RemainingArgs)]
Implicitly added by option

Attributes

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

Attributes

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

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 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]
Implicitly added by either

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
final def get(d: D): Either[Error, T]
Implicitly added by option

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
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
final def parse(args: Seq[String]): Either[Error, (T, Seq[String])]
Implicitly added by either

Attributes

Inherited from:
ParserMethods
final def parse(args: Seq[String]): Either[Error, (T, Seq[String])]
Implicitly added by option

Attributes

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

Attributes

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

Attributes

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

Attributes

Inherited from:
ParserMethods
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])]]
Implicitly added by either

Attributes

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

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

Inherited and Abstract methods

def args: Seq[Arg]
Implicitly added by either

Arguments this parser accepts.

Arguments this parser accepts.

Used to generate help / usage messages.

Attributes

Inherited from:
ParserMethods
def args: Seq[Arg]
Implicitly added by option

Arguments this parser accepts.

Arguments this parser accepts.

Used to generate help / usage messages.

Attributes

Inherited from:
ParserMethods
def args: Seq[Arg]

Arguments this parser accepts.

Arguments this parser accepts.

Used to generate help / usage messages.

Attributes

Inherited from:
ParserMethods
def get(d: D, nameFormatter: Formatter[Name]): Either[Error, T]
Implicitly added by either

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

Inherited from:
ParserMethods
def get(d: D, nameFormatter: Formatter[Name]): Either[Error, T]
Implicitly added by option

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

Inherited from:
ParserMethods
def get(d: D, nameFormatter: Formatter[Name]): 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

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
def init: D
Implicitly added by either

Initial value used to accumulate parsed arguments.

Initial value used to accumulate parsed arguments.

Attributes

Inherited from:
ParserMethods
def init: D
Implicitly added by option

Initial value used to accumulate parsed arguments.

Initial value used to accumulate parsed arguments.

Attributes

Inherited from:
ParserMethods
def init: D

Initial value used to accumulate parsed arguments.

Initial value used to accumulate parsed arguments.

Attributes

Inherited from:
ParserMethods
def step(args: List[String], index: Int, d: D, nameFormatter: Formatter[Name]): Either[(Error, Arg, List[String]), Option[(D, Arg, List[String])]]
Implicitly added by either

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.

Inherited from:
ParserMethods
def step(args: List[String], index: Int, d: D, nameFormatter: Formatter[Name]): Either[(Error, Arg, List[String]), Option[(D, Arg, List[String])]]
Implicitly added by option

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.

Inherited from:
ParserMethods
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.

Inherited from:
ParserMethods

Concrete fields

val parser: Parser[T]
Implicitly added by toParserOps