DefaultConverters

This trait contains various predefined converters for common use-cases. org.rogach.scallop package object inherits from this trait, thus you can get all the converters simply by importing org.rogach.scallop._.

This trait contains various predefined converters for common use-cases. org.rogach.scallop package object inherits from this trait, thus you can get all the converters simply by importing org.rogach.scallop._.

class Object
trait Matchable
class Any

Value members

Concrete methods

def listArgConverter[A](conv: String => A): ValueConverter[List[A]]

Creates a converter for an option which accepts multiple arguments.

Creates a converter for an option which accepts multiple arguments.

Value Params
conv

The conversion function to use on each argument. May throw an exception on error.

Returns

A ValueConverter instance.

def numberHandler[T](name: String): PartialFunction[Throwable, Either[String, Option[T]]]

Handler function for numeric types which expects a NumberFormatException and prints a more helpful error message.

Handler function for numeric types which expects a NumberFormatException and prints a more helpful error message.

Value Params
name

the type name to display

def optDefault[A](default: A)(conv: ValueConverter[A]): ValueConverter[A]

Creates a converter for an option with single optional argument (it will parse both --opt and --opt arg command lines).

Creates a converter for an option with single optional argument (it will parse both --opt and --opt arg command lines).

Value Params
conv

Converter instance to use if argument was provided.

default

The default value to use if argument wasn't provided.

Returns

A ValueConverter instance.

def propsConverter[A](conv: ValueConverter[A]): ValueConverter[Map[String, A]]

Creates a converter for a property option.

Creates a converter for a property option.

Value Params
conv

The converter function to use on each value. May throw an exception on error.

Returns

A ValueConverter instance.

def singleArgConverter[A](conv: String => A, handler: PartialFunction[Throwable, Either[String, Option[A]]]): ValueConverter[A]

Creates a converter for an option with a single argument.

Creates a converter for an option with a single argument.

Value Params
conv

The conversion function to use. May throw an exception on error.

handler

An error handler function for writing custom error messages.

Returns

A ValueConverter instance.

Concrete fields

Converter for a tally option, used in ScallopConf.tally

Converter for a tally option, used in ScallopConf.tally

Implicits

Implicits

implicit val bigDecimalConverter: ValueConverter[BigDecimal]
implicit val bigIntConverter: ValueConverter[BigInt]
implicit val byteConverter: ValueConverter[Byte]
implicit val byteListConverter: ValueConverter[List[Byte]]
implicit val bytePropsConverter: ValueConverter[Map[String, Byte]]
implicit val charConverter: ValueConverter[Char]
implicit val charPropsConverter: ValueConverter[Map[String, Char]]
implicit val doubleConverter: ValueConverter[Double]
implicit val doubleListConverter: ValueConverter[List[Double]]
implicit val doublePropsConverter: ValueConverter[Map[String, Double]]
implicit val durationConverter: ValueConverter[Duration]
implicit val finiteDurationConverter: ValueConverter[FiniteDuration]
implicit val flagConverter: ValueConverter[Boolean]
implicit val floatConverter: ValueConverter[Float]
implicit val floatListConverter: ValueConverter[List[Float]]
implicit val floatPropsConverter: ValueConverter[Map[String, Float]]
implicit val intConverter: ValueConverter[Int]
implicit val intListConverter: ValueConverter[List[Int]]
implicit val intPropsConverter: ValueConverter[Map[String, Int]]
implicit val longConverter: ValueConverter[Long]
implicit val longListConverter: ValueConverter[List[Long]]
implicit val longPropsConverter: ValueConverter[Map[String, Long]]
implicit val shortConverter: ValueConverter[Short]
implicit val shortListConverter: ValueConverter[List[Short]]
implicit val shortPropsConverter: ValueConverter[Map[String, Short]]
implicit val stringConverter: ValueConverter[String]
implicit val stringListConverter: ValueConverter[List[String]]
implicit val stringPropsConverter: ValueConverter[Map[String, String]]