org.rogach.scallop

Type members

Classlikes

object ArgType

An enumeration of possible arg types by number of arguments they can take.

An enumeration of possible arg types by number of arguments they can take.

sealed trait CliOption

Parent class for option descriptors. Each option descriptor contains everything needed to parse that option - option names, defaults, converters, validators, etc.

Parent class for option descriptors. Each option descriptor contains everything needed to parse that option - option names, defaults, converters, validators, etc.

object Compat

Contains helper functions to handle differences between different platforms (JVM, Native, JS).

Contains helper functions to handle differences between different platforms (JVM, Native, JS).

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._.

object Formatter
case class HelpInfo(argLine: String, description: String, defaultValue: () => Option[String])

Internal class - container for help information for a single option.

Internal class - container for help information for a single option.

class LazyMap[A, +B](under: => Map[A, B], _name: String, _isSupplied: () => Boolean, val cliOption: Option[CliOption]) extends Map[A, B] with ScallopOptionBase

A class that lazily encapsulates a map inside.

A class that lazily encapsulates a map inside.

case class LongNamedPropertyOption(name: String, descr: String, converter: ValueConverter[_], keyName: String, valueName: String, hidden: Boolean) extends CliOption

Descriptor for a property option with a "long" name (like --Props key1=value1 key2=value2).

Descriptor for a property option with a "long" name (like --Props key1=value1 key2=value2).

Value Params
converter

The converter for this option.

descr

Description for this property option, for help description.

hidden

If set to true, then this option will be hidden from generated help output.

keyName

Name for 'key' part of this option arg name, as it will appear in help option definition.

name

Internal name for the option.

valueName

Name for 'value' part of this option arg name, as it will appear in help option definition.

case class NumberArgOption(name: String, required: Boolean, descr: String, converter: ValueConverter[Long], validator: Any => Boolean, default: () => Option[Long], hidden: Boolean) extends CliOption

Descriptor for a number option (-1 or -3, like GNU tail for example).

Descriptor for a number option (-1 or -3, like GNU tail for example).

Value Params
converter

The converter for this option.

default

If this argument is not required and not found in the argument list, use this value.

descr

Description for this option, for help text.

hidden

If set to true then this option will not be present in auto-generated help.

name

Name for new definition, used for identification.

required

Is this trailing argument required?

validator

The function that validates the parsed value.

case class PropertyOption(name: String, short: Char, descr: String, converter: ValueConverter[_], keyName: String, valueName: String, hidden: Boolean) extends CliOption

Descriptor for a property option (like -Dkey=value or -D key1=value1 key2=value2).

Descriptor for a property option (like -Dkey=value or -D key1=value1 key2=value2).

Value Params
converter

The converter for this option.

descr

Description for this property option, for help description.

hidden

If set to true, then this option will be hidden from generated help output.

keyName

Name for 'key' part of this option arg name, as it will appear in help option definition.

name

Internal name for the option.

short

Character that will be used as prefix for property arguments.

valueName

Name for 'value' part of this option arg name, as it will appear in help option definition.

case class Scallop(args: Seq[String], opts: List[CliOption], mainOptions: List[CliOption], optionGroups: List[(String, Seq[CliOption])], vers: Option[String], bann: Option[String], foot: Option[String], descr: String, helpWidth: Option[Int], shortSubcommandsHelp: Boolean, appendDefaultToDescription: Boolean, noshort: Boolean, helpFormatter: ScallopHelpFormatter, subbuilders: List[(String, Scallop)]) extends ScallopArgListLoader

Internal configuration builder.

Internal configuration builder.

abstract class ScallopConf(args: Seq[String], commandNameAndAliases: Seq[String]) extends ScallopConfBase

Base class for CLI parsers.

Base class for CLI parsers.

abstract class ScallopConfBase(val args: Seq[String], val commandNameAndAliases: Seq[String]) extends ScallopConfValidations

Contains non-platform-specific functionality of ScallopConf.

Contains non-platform-specific functionality of ScallopConf.

Helper trait for generaton of validate methods on ScallopConf.

Helper trait for generaton of validate methods on ScallopConf.

Used by ScallopConf.helpFormatter to create help output. Users of the library can override chosen (or all) methods to tweak help output to their requirements.

Used by ScallopConf.helpFormatter to create help output. Users of the library can override chosen (or all) methods to tweak help output to their requirements.

abstract class ScallopOption[A](nm: () => String, val cliOption: Option[CliOption], val _transformCount: Int) extends ScallopOptionBase

A class to hold a reference to not-yet-computed option values.

A class to hold a reference to not-yet-computed option values.

Basically, this is a lazy option - it batches up all operations, and evaluates the value only as the last resort.

Value Params
_transformCount

Count of .map, .filter, etc. operations applied to this option

cliOption

option descriptor (names, converters, validatiors, etc.)

nm

Name for the option

class ScallopOptionGroup(val header: String)

Group of options. Options added to the group will be shown before all other options in help output, in the same order as they were added in. (options without groups will be sorted alphabetically and shown after all option groups)

Group of options. Options added to the group will be shown before all other options in help output, in the same order as they were added in. (options without groups will be sorted alphabetically and shown after all option groups)

Value Params
header

Header string that will be printed immediately before corresponding options.

trait Serialization extends Serializable

Use this trait to make your ScallopConf serializable. Warning: this serialization method expects your ScallopConf class to have public constructor that accepts Seq[String] or List[String] as a single parameter.

Use this trait to make your ScallopConf serializable. Warning: this serialization method expects your ScallopConf class to have public constructor that accepts Seq[String] or List[String] as a single parameter.

If your class does not have such constructor, you will need to implement serialization/deserialization logic yourself (see https://github.com/scallop/scallop/issues/137)

class SerializationProxy(var orig: ScallopConf, val confClassName: String) extends Serializable
case class SimpleOption(name: String, short: Option[Char], descr: String, required: Boolean, converter: ValueConverter[_], default: () => Option[Any], validator: Any => Boolean, argName: String, hidden: Boolean, noshort: Boolean) extends CliOption

Descriptor for a simple option - describes flag, one-arg or multi-arg options (--opt [ARGS]...).

Descriptor for a simple option - describes flag, one-arg or multi-arg options (--opt [ARGS]...).

Value Params
argName

The name for this option argument, as it will appear in help.

converter

The converter for this option.

default

Default value to use if option is not found in input arguments.

descr

Description for this option, for help output.

hidden

Hides description of this option from help (this can be useful for debugging options).

name

Name for new option, used as long option name in parsing, and for option identification.

noshort

If set to true, then this option does not have any short name.

required

Is this option required?

short

Overload the char that will be used as short option name.

validator

The function that validates the parsed value.

class Subcommand(commandNameAndAliases: String*) extends ScallopConf

Base class for CLI subcommands.

Base class for CLI subcommands.

case class ToggleOption(name: String, default: () => Option[Boolean], short: Option[Char], noshort: Boolean, prefix: String, descrYes: String, descrNo: String, required: Boolean, hidden: Boolean) extends CliOption

Descriptor for a toggle option (like --verbose/--noverbose).

Descriptor for a toggle option (like --verbose/--noverbose).

Value Params
default

Default value for this option.

descrNo

Description for negative variant of this option.

descrYes

Description for positive variant of this option.

hidden

If set to true, then this option will not be present in auto-generated help.

name

Name of this option.

noshort

If set to true, then this option will not have any short name.

prefix

Prefix to name of the option, that will be used for "negative" version of the option.

required

Is this option required?

short

Overload the char that will be used as short option name.

case class TrailingArgsOption(name: String, required: Boolean, descr: String, converter: ValueConverter[_], validator: Any => Boolean, default: () => Option[Any], hidden: Boolean) extends CliOption

Descriptor for a trailing arg option.

Descriptor for a trailing arg option.

Value Params
converter

The converter for this option.

default

If this argument is not required and not found in the argument list, use this value.

descr

Description for this option, for help text.

hidden

If set to true then this option will not be present in auto-generated help.

name

Name for new definition, used for identification.

required

Is this trailing argument required?

validator

The function that validates the parsed value.

Parses the trailing arguments (including the arguments to last option). Uses simple backtraking algorithm.

Parses the trailing arguments (including the arguments to last option). Uses simple backtraking algorithm.

object Util
trait ValueConverter[A]

Converter from list of plain strings to something meaningful.

Converter from list of plain strings to something meaningful.

object overrideColorOutput extends DynamicVariable[Option[Boolean]]
object throwError extends DynamicVariable[Boolean]

Value members

Inherited 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.

Inherited from
DefaultConverters
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

Inherited from
DefaultConverters
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.

Inherited from
DefaultConverters
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.

Inherited from
DefaultConverters
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.

Inherited from
DefaultConverters

Inherited fields

Converter for a tally option, used in ScallopConf.tally

Converter for a tally option, used in ScallopConf.tally

Inherited from
DefaultConverters

Implicits

Implicits

implicit val fileConverter: ValueConverter[File]
implicit val fileListConverter: ValueConverter[List[File]]
implicit val pathConverter: ValueConverter[Path]
implicit val pathListConverter: ValueConverter[List[Path]]
implicit val uriConverter: ValueConverter[URI]
implicit val urlConverter: ValueConverter[URL]

Inherited implicits

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