Class/Object

org.rogach.scallop

Scallop

Related Docs: object Scallop | package scallop

Permalink

case class Scallop(args: Seq[String] = Nil, opts: List[CliOption] = Nil, mainOpts: List[String] = Nil, vers: Option[String] = None, bann: Option[String] = None, foot: Option[String] = None, descr: String = "", helpWidth: Option[Int] = None, shortSubcommandsHelp: Boolean = false, appendDefaultToDescription: Boolean = false, subbuilders: List[(String, Scallop)] = Nil, parent: Option[Scallop] = None) extends Product with Serializable

The main builder class.

args

Arguments to parse.

opts

Options definitions.

mainOpts

Names of options, that are to be printed first in the help printout

vers

Version string to display in help.

bann

Banner (summary of this program and command-line usage) to display in help.

foot

Footer - displayed after options.

descr

Short description - used for subcommands

helpWidth

Width, to which the help output will be formatted (note that banner, footer, version and description are not affected!)

shortSubcommandsHelp

If true, then help output from this builder wouldn't list full help for subcommands, only short description

subbuilders

subcommands in this builder

Source
Scallop.scala
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Scallop
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Scallop(args: Seq[String] = Nil, opts: List[CliOption] = Nil, mainOpts: List[String] = Nil, vers: Option[String] = None, bann: Option[String] = None, foot: Option[String] = None, descr: String = "", helpWidth: Option[Int] = None, shortSubcommandsHelp: Boolean = false, appendDefaultToDescription: Boolean = false, subbuilders: List[(String, Scallop)] = Nil, parent: Option[Scallop] = None)

    Permalink

    args

    Arguments to parse.

    opts

    Options definitions.

    mainOpts

    Names of options, that are to be printed first in the help printout

    vers

    Version string to display in help.

    bann

    Banner (summary of this program and command-line usage) to display in help.

    foot

    Footer - displayed after options.

    descr

    Short description - used for subcommands

    helpWidth

    Width, to which the help output will be formatted (note that banner, footer, version and description are not affected!)

    shortSubcommandsHelp

    If true, then help output from this builder wouldn't list full help for subcommands, only short description

    subbuilders

    subcommands in this builder

Type Members

  1. case class ParseResult(opts: Parsed = Nil, subcommand: Option[String] = None, subcommandArgs: List[String] = Nil) extends Product with Serializable

    Permalink
  2. type Parsed = List[(CliOption, (String, List[String]))]

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addSubBuilder(name: String, builder: Scallop): Scallop

    Permalink

    Adds a subbuilder (subcommand) to this builder.

    Adds a subbuilder (subcommand) to this builder.

    name

    All arguments after this string would be routed to this builder.

  5. val appendDefaultToDescription: Boolean

    Permalink
  6. def apply[A](name: Char)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[A]): A

    Permalink
  7. def apply[A](name: String)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[A]): A

    Permalink

    Get the value of option.

    Get the value of option. If option is not found, this will throw an exception.

    name

    Name for option.

    tt

    TypeTag for requested type. Usually found implicitly.

  8. def args(a: Seq[String]): Scallop

    Permalink

    Add some more arguments to this builder.

    Add some more arguments to this builder. They are appended to the end of the original list.

    a

    arg list to add

  9. val args: Seq[String]

    Permalink

    Arguments to parse.

  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. val bann: Option[String]

    Permalink

    Banner (summary of this program and command-line usage) to display in help.

  12. def banner(b: String): Scallop

    Permalink

    Add banner string to this builder.

    Add banner string to this builder. Banner should describe your program and provide a short summary on it's usage.

    b

    Banner string, can contain multiple lines. Note this is not formatted to 80 characters!

  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. val descr: String

    Permalink

    Short description - used for subcommands

  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def findSubbuilder(name: String): Option[Scallop]

    Permalink

    Traverses the tree of subbuilders, using the provided name.

    Traverses the tree of subbuilders, using the provided name.

    name

    Names of subcommand names, that lead to the needed builder, separated by \\0.

  18. val foot: Option[String]

    Permalink

    Footer - displayed after options.

  19. def footer(f: String): Scallop

    Permalink

    Add footer string to this builder.

    Add footer string to this builder. Footer will be printed in help after option definitions.

    f

    Footer string, can contain multiple lines. Note this is not formatted to 80 characters!

  20. def get[A](name: Char)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[A]): Option[A]

    Permalink
  21. def get[A](name: String)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[A]): Option[A]

    Permalink

    Get the value of option (or trailing arg) as Option.

    Get the value of option (or trailing arg) as Option.

    name

    Name for option.

    tt

    TypeTag for requested type. Usually found implicitly.

  22. def getAllSuppliedOptionNames: List[String]

    Permalink

    Retrieves a list of all supplied options (including options from subbuilders).

  23. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  24. def getOptionShortNames(opt: CliOption): List[Char]

    Permalink
  25. def getOptionWithShortName(c: Char): Option[CliOption]

    Permalink

    Find an option, that responds to this short name.

  26. def getSubbuilder: Option[Scallop]

    Permalink

    Retrieves the subbuilder object, that matches the name of the subcommand found in input arguments.

  27. def getSubcommandArgs: List[String]

    Permalink

    Returns the subcommand arguments.

  28. def getSubcommandName: Option[String]

    Permalink

    Retrieves name of the subcommand that was found in input arguments.

  29. def getSubcommandNames: List[String]

    Permalink

    Returns the list of subcommand names, recursively.

  30. def help: String

    Permalink

    Get help on options from this builder.

    Get help on options from this builder. The resulting help is carefully formatted to required number of columns (default = 80, change with .setHelpWidth method), and contains info on properties, options and trailing arguments.

  31. val helpWidth: Option[Int]

    Permalink

    Width, to which the help output will be formatted (note that banner, footer, version and description are not affected!)

  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def isSupplied(name: String): Boolean

    Permalink

    Tests if this option or trailing arg was explicitly provided by argument list (not from default).

    Tests if this option or trailing arg was explicitly provided by argument list (not from default).

    name

    Identifier of option or trailing arg definition

  34. val mainOpts: List[String]

    Permalink

    Names of options, that are to be printed first in the help printout

  35. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. def number(name: String, required: Boolean = false, descr: String = "", default: () ⇒ Option[Long] = () => None, validate: (Long) ⇒ Boolean = (_:Long) => true, hidden: Boolean = false)(implicit conv: ValueConverter[Long]): Scallop

    Permalink

    Add new number argument definition to this builder.

    Add new number argument definition to this builder.

    name

    Name for new definition, used for identification.

    required

    Is this trailing argument required? Defaults to true.

    descr

    Description for this option, for help text.

    default

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

    validate

    The function that validates the parsed value.

    hidden

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

  39. def opt[A](name: String, short: Char = '\u0000', descr: String = "", default: () ⇒ Option[A] = () => None, validate: (A) ⇒ Boolean = (_:A) => true, required: Boolean = false, argName: String = "arg", hidden: Boolean = false, noshort: Boolean = false)(implicit conv: ValueConverter[A]): Scallop

    Permalink

    Add a new option definition to this builder.

    Add a new option definition to this builder.

    name

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

    short

    Overload the char that will be used as short option name. Defaults to first character of the name.

    descr

    Description for this option, for help description.

    default

    Default value to use if option is not found in input arguments (if you provide this, you can omit the type on method).

    validate

    The function, that validates the parsed value

    required

    Is this option required? Defaults to false.

    argName

    The name for this ortion argument, as it will appear in help. Defaults to "arg".

    hidden

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

    noshort

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

    conv

    The converter for this option. Usually found implicitly.

  40. val opts: List[CliOption]

    Permalink

    Options definitions.

  41. var parent: Option[Scallop]

    Permalink
  42. def printHelp(): Unit

    Permalink

    Print help message (with version, banner, option usage and footer) to stdout.

  43. def prop[A](name: Char, key: String)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[Map[String, A]]): Option[A]

    Permalink
  44. def props[A](name: Char, descr: String = "", keyName: String = "key", valueName: String = "value", hidden: Boolean = false)(implicit conv: ValueConverter[Map[String, A]]): Scallop

    Permalink

    Add new property option definition to this builder.

    Add new property option definition to this builder.

    name

    Char, that will be used as prefix for property arguments.

    descr

    Description for this property option, for help description.

    keyName

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

    valueName

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

  45. def propsLong[A](name: String, descr: String = "", keyName: String = "key", valueName: String = "value", hidden: Boolean = false)(implicit conv: ValueConverter[Map[String, A]]): Scallop

    Permalink
  46. def setHelpWidth(w: Int): Scallop

    Permalink

    Explicitly sets the needed width for the help printout.

  47. val shortSubcommandsHelp: Boolean

    Permalink

    If true, then help output from this builder wouldn't list full help for subcommands, only short description

  48. val subbuilders: List[(String, Scallop)]

    Permalink

    subcommands in this builder

  49. def summary: String

    Permalink

    Get summary of current parser state.

    Get summary of current parser state.

    Returns a list of all options in the builder, and corresponding values for them.

  50. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  51. def toggle(name: String, default: () ⇒ Option[Boolean] = () => None, short: Char = '\u0000', noshort: Boolean = false, prefix: String = "no", descrYes: String = "", descrNo: String = "", hidden: Boolean = false): Scallop

    Permalink

    Add new toggle option definition to this builer.

    Add new toggle option definition to this builer.

    name

    Name for new definition, used for identification.

    default

    Default value

    short

    Name for short form 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.

    descrYes

    Description for positive variant of this option.

    descrNo

    Description for negative variant of this option.

    hidden

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

  52. def trailArg[A](name: String, required: Boolean = true, descr: String = "", default: () ⇒ Option[A] = () => None, validate: (A) ⇒ Boolean = (_:A) => true, hidden: Boolean = false)(implicit conv: ValueConverter[A]): Scallop

    Permalink

    Add new trailing argument definition to this builder.

    Add new trailing argument definition to this builder.

    name

    Name for new definition, used for identification.

    required

    Is this trailing argument required? Defaults to true.

    descr

    Description for this option, for help text.

    default

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

    validate

    The function, that validates the parsed value

  53. def verify: Scallop

    Permalink

    Verify the builder.

    Verify the builder. Parses arguments, makes sure no definitions clash, no garbage or unknown options are present, and all present arguments are in proper format. It is recommended to call this method before using the results.

    If there is "--help" or "--version" option present, it prints help or version statement and exits.

  54. val vers: Option[String]

    Permalink

    Version string to display in help.

  55. def version(v: String): Scallop

    Permalink

    Add version string to this builder.

    Add version string to this builder.

    v

    Version string, to be printed before all other things in help.

  56. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped