default

object default extends Api
trait Api
trait Api
trait VersionSpecificApi
trait ReadersApi
trait LowPrioReaders
trait MainArgsApi
trait ParsersApi
trait LowPrioParamBuilders
trait TypesApi
trait LowPrio
trait SettingApi
class Object
trait Matchable
class Any
default.type

Type members

Inherited classlikes

class ArgumentParser(val description: String, val enableHelpFlag: Boolean, val enableBashCompletionFlag: Boolean, val stdout: PrintStream, val stderr: PrintStream)

A simple command line argument parser.

A simple command line argument parser.

Usage:

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

  2. Call parse() 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.ArgumentParser("0.1.0")

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

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

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

enableBashCompletionFlag

Include a --bash-completion flag which generate a bash completion script.

enableHelpFlag

Include a --help flag which will print a generated help message.

env

The environment.

stdout

The standard error stream.

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
trait ParamBuilder[A]
Inherited from:
MainArgsApi
object PathReader extends FsPathReader[Path]
Inherited from:
ReadersApi
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
case class main() extends StaticAnnotation

Mark a method as an application entrypoint.

Mark a method as an application entrypoint.

This will generate a main method, which will call the annotated method after parsing the command line.

The mapping between the CLI arguments to the annotated method is as follows:

| Parameter Type | Has Default Value? | CLI +----------------+--------------------+----- | Boolean | yes | --named flag | Boolean | no | positional | Iterable[A] | yes | --named repeated parameter | Iterable[A] | no | positional repeated paramater | A | yes | --named parameter | A | no | positional paramter

These mappings can be overridden by defining custom ParamBuilders.

Inherited from:
MainArgsApi

Inherited types

type FileReader = (Path, MutableCtx, SettingTree) => Unit
Inherited from:
SettingApi
type arg = arg
Inherited from:
MainArgsApi

Value members

Inherited methods

def bashCompletionFlag: String

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 the empty string to disable bash-completion entirely.

Inherited from:
ParsersApi
def checkStyle(_paramDefs: Iterable[ParamDef], stderr: PrintStream): Unit

Check the style of parameters.

Check the style of parameters.

This is intended to nudge developers into building command line applications that integrate seamlessly into other system utilities and provide a pleasant user experience.

This is subjective, and you may disable style-checking by overriding this method.

Inherited from:
ParsersApi
def commandName(scalaName: String): String
Inherited from:
MainArgsApi
inline def dispatch[A](container: => A, args: Array[String], env: Map[String, String]): Unit

Generate a main method for a single entry point.

Generate a main method for a single entry point.

This method will become obsolete once annotation macros become available in scala 3.

Inherited from:
MainArgsApi
protected def exit(code: Int): Nothing
Inherited from:
ParsersApi
def help(description: String, params: Seq[ParamInfo], commands: Seq[CommandInfo]): 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
def paramName(scalaName: String): String
Inherited from:
MainArgsApi
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 arg: arg.type
Inherited from:
MainArgsApi
val pathCompleter: String => Seq[String]
Inherited from:
ReadersApi
val yamlReader: FileReader
Inherited from:
YamlesqueCompat

Givens

Inherited givens

given given_ParamBuilder_A[A](using reader: Reader[A]): given_ParamBuilder_A[A]
Inherited from:
LowPrioParamBuilders
given given_ParamBuilder_Boolean(using reader: Reader[Boolean]): given_ParamBuilder_Boolean
Inherited from:
MainArgsApi
given given_ParamBuilder_Col[A, Col <: (Iterable)](using reader: Reader[A]): given_ParamBuilder_Col[A, Col]
Inherited from:
MainArgsApi
given given_ParamBuilder_S[S](using root: SettingRoot[S], pr: Reader[Path]): given_ParamBuilder_S[S]
Inherited from:
ArgparseParams
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 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