Api

trait Api extends SettingApi with ArgparseReaders with TypesApi with YamlesqueCompat
trait Api
trait VersionSpecificApi
trait MacroApi
trait OutputApi
trait Printers
trait LowPrioPrinters
trait ReadersApi
trait LowPrioReaders
trait ParsersApi
trait TypesApi
trait LowPrio
trait SettingApi
class Object
trait Matchable
class Any
object default.type

Type members

Inherited classlikes

class ArgumentParser(val description: String, val helpFlags: Seq[String], val bashCompletionFlags: Seq[String])

A simple command line argument parser.

A simple command line argument parser.

Usage:

  1. Define parameters with param, requiredParam and repeatedParam. Each of these methods gives back a handle to a future argument value.

  2. Call parseOrExit() with actual arguments.

  3. If parsing succeeds, the arguments will be available in the handles defined in step 1.

If parsing fails, error descriptions are printed and the program exits with 2.

Example:

val parser = argparse.default.ArgumentParser()

val p1 = parser.param[String]("--this-is-a-named-param", default = "default value")
val p2 = parser.param[Int]("positional-param", default = 2)

parser.parseOrExit(Seq("--this-is-a-named-param=other", 5))
println(p1.value)
println(p2.value)
Value parameters:
bashCompletionFlag

Use these flags to print a sourceable bash-completion script. Set to empty to disable.

description

A short description of this command. Used in help messages.

helpFlags

Use these flags to print the help message. Set to empty to disable.

Inherited from:
ParsersApi
Inherited from:
ParsersApi
object BooleanReader extends Reader[Boolean]
Inherited from:
ReadersApi
object DoubleReader extends Reader[Double]
Inherited from:
ReadersApi
object DurationReader extends Reader[Duration]
Inherited from:
ReadersApi
object FilePathReader extends FsPathReader[FilePath]
Inherited from:
ReadersApi
object FiniteDurationReader extends Reader[FiniteDuration]
Inherited from:
ReadersApi
object FloatReader extends Reader[Float]
Inherited from:
ReadersApi
trait FsPathReader[A] extends Reader[A]
Inherited from:
ReadersApi
object InputStreamReader extends Reader[() => InputStream]
Inherited from:
ReadersApi
object InstantReader extends Reader[Instant]
Inherited from:
ReadersApi
object JavaFileReader extends FsPathReader[File]
Inherited from:
ReadersApi
object JavaPathReader extends FsPathReader[Path]
Inherited from:
ReadersApi
object LocalDateReader extends Reader[LocalDate]
Inherited from:
ReadersApi
object LocalDateTimeReader extends Reader[LocalDateTime]
Inherited from:
ReadersApi
object LocalTime extends Reader[LocalTime]
Inherited from:
ReadersApi
object OutputStreamReader extends Reader[() => OutputStream]
Inherited from:
ReadersApi
object PathReader extends FsPathReader[Path]
Inherited from:
ReadersApi
trait Printer[A]
Inherited from:
OutputApi
object RangeReader extends Reader[Range]
Inherited from:
ReadersApi
object ReadableReader extends Reader[Readable]
Inherited from:
ReadersApi
object Reader
Inherited from:
TypesApi
@implicitNotFound("No Reader[${A}] found. A reader is required to parse a command line argument from a string to a ${A}. ".+("Please define a Reader[${A}]."))
trait Reader[A]

A typeclass that defines how to convert a string from a single command line argument to a given type.

A typeclass that defines how to convert a string from a single command line argument to a given type.

Inherited from:
TypesApi
object RelPathReader extends FsPathReader[RelPath]
Inherited from:
ReadersApi
class Setting[A](val default: Option[() => A], val description: String, val reader: SettingReader[A])
Inherited from:
SettingApi
trait SettingReader[A] extends Visitor[Option[A]]
Inherited from:
SettingApi
Inherited from:
SettingApi
trait SettingRoot[S]
Inherited from:
SettingApi
object SubPathReader extends FsPathReader[SubPath]
Inherited from:
ReadersApi
object ZonedDateTimeReader extends Reader[ZonedDateTime]
Inherited from:
ReadersApi
class command() extends StaticAnnotation
Inherited from:
MacroApi
object given_Printer_Array extends Printer[Array[Byte]]
Inherited from:
Printers
object given_Printer_Unit extends Printer[Unit]
Inherited from:
Printers
object given_Printer_Writable extends Printer[Writable]
Inherited from:
Printers
class unknownCommand() extends StaticAnnotation
Inherited from:
MacroApi

Inherited types

type FileReader = (Path, MutableCtx, SettingTree) => Unit
Inherited from:
SettingApi
type alias = alias
Inherited from:
MacroApi
type env = env
Inherited from:
MacroApi
type name = name
Inherited from:
MacroApi

Value members

Inherited methods

The name of the flag to use for generating standalone bash-completion.

The name of the flag to use for generating standalone bash-completion.

Set this to empty to disable bash-completion entirely.

Note that individual argument parsers may override this.

Inherited from:
ParsersApi
def defaultHelpFlags: Seq[String]

The name of the flag to use for printing help messages.

The name of the flag to use for printing help messages.

Set this to empty to disable help entirely.

Note that individual argument parsers may override this.

Inherited from:
ParsersApi
def defaultHelpMessage(parser: ArgumentParser): String

Generate a help message from parameters.

Generate a help message from parameters.

This message will be used by ArgumentParsers. Overriding this allows you to customize the help message of all ArgumentParsers.

Inherited from:
ParsersApi
protected def exit(code: Int): Nothing

Called by parseOrExit in case of error.

Called by parseOrExit in case of error.

Overriding this can be useful in situations where you do not want to exit, for example in tests.

Inherited from:
ParsersApi
def handleError(t: Throwable): Nothing

Top-level error handler for command line applications using the annotation API.

Top-level error handler for command line applications using the annotation API.

You can override this to change what should be done on errors.

The default implementation prints the exception's message unless the DEBUG environment variable is set, in which case the whole stack trace is printed. Then, it exits with error code 1.

Inherited from:
OutputApi
def read[S](settings: S, sources: Seq[Path], envPrefix: String, env: Map[String, String], check: Boolean, err: PrintStream)(using root: SettingRoot[S]): Boolean
Inherited from:
SettingApi
def registerSettingExtension(ext: String, accept: (Path, MutableCtx, SettingTree) => Unit): LinkedHashMap[String, FileReader]

Extension to reader

Extension to reader

Inherited from:
SettingApi
def setting[A](default: => A)(using reader: SettingReader[A], doc: DocComment): Setting[A]
Inherited from:
SettingApi
def settingKeyName(scalaName: String): String

Convert a scala variable name to a setting name.

Convert a scala variable name to a setting name.

Inherited from:
SettingApi

Inherited fields

val alias: alias.type
Inherited from:
MacroApi
val env: env.type
Inherited from:
MacroApi
val name: name.type
Inherited from:
MacroApi
val pathCompleter: String => Seq[String]
Inherited from:
ReadersApi
val yamlReader: FileReader
Inherited from:
YamlesqueCompat

Givens

Inherited givens

given given_Printer_A[A]: given_Printer_A[A]
Inherited from:
LowPrioPrinters
Inherited from:
Printers
given given_Printer_Future[A](using p: Printer[A]): given_Printer_Future[A]
Inherited from:
Printers
given given_Printer_Generator[A](using p: Printer[A]): given_Printer_Generator[A]
Inherited from:
Printers
Inherited from:
Printers
Inherited from:
Printers
given given_SettingReader_Col[Elem, Col <: (Iterable)](using elemReader: SettingReader[Elem], factory: Factory[Elem, Col[Elem]]): given_SettingReader_Col[Elem, Col]
Inherited from:
ArgparseReaders
given nonProductListPrinter[A <: Iterable[B], B](using elemPrinter: Printer[B]): nonProductListPrinter[A, B]
Inherited from:
Printers
given productListPrinter[A <: Iterable[B], B <: Product](using m: ProductLabels[B]): productListPrinter[A, B]
Inherited from:
Printers
given scalarReader[A](using areader: Reader[A]): scalarReader[A]
Inherited from:
LowPrio

Implicits

Inherited implicits

implicit def CollectionReader[Elem, Col <: (Iterable)](implicit elementReader: Reader[Elem], factory: Factory[Elem, Col[Elem]]): Reader[Col[Elem]]
Inherited from:
LowPrioReaders
implicit def FilePathCollectionReader[Col <: Iterable[FilePath]](implicit factory: Factory[FilePath, Col], pathReader: Reader[FilePath]): Reader[Col]
Inherited from:
ReadersApi
implicit def IntegralReader[N](implicit numeric: Integral[N]): Reader[N]
Inherited from:
ReadersApi
implicit def JFileCollectionReader[Col <: Iterable[File]](implicit factory: Factory[File, Col], pathReader: Reader[File]): Reader[Col]
Inherited from:
ReadersApi
implicit def JPathCollectionReader[Col <: Iterable[Path]](implicit factory: Factory[Path, Col], pathReader: Reader[Path]): Reader[Col]
Inherited from:
ReadersApi
implicit def Mapping[K, V](implicit kr: Reader[K], vr: Reader[V]): Reader[(K, V)]
Inherited from:
ReadersApi
implicit def OptionReader[A](implicit elementReader: Reader[A]): Reader[Option[A]]
Inherited from:
ReadersApi
implicit def PathCollectionReader[Col <: Iterable[Path]](implicit factory: Factory[Path, Col], pathReader: Reader[Path]): Reader[Col]
Inherited from:
ReadersApi
implicit def RelPathCollectionReader[Col <: Iterable[RelPath]](implicit factory: Factory[RelPath, Col], pathReader: Reader[RelPath]): Reader[Col]
Inherited from:
ReadersApi
implicit val StringReader: Reader[String]
Inherited from:
TypesApi
implicit def SubPathCollectionReader[Col <: Iterable[SubPath]](implicit factory: Factory[SubPath, Col], pathReader: Reader[SubPath]): Reader[Col]
Inherited from:
ReadersApi