org.rogach.scallop

Scallop

case class Scallop(args: Seq[String], opts: List[CliOption], mainOpts: List[String], vers: Option[String], bann: Option[String], foot: Option[String], descr: String, optionSetValidations: List[(List[String]) ⇒ Either[String, Unit]], helpWidth: Option[Int], shortSubcommandsHelp: Boolean, subbuilders: List[(String, Scallop)]) 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

optionSetValidations

Validations, that enforce some rules on groups of options

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. Hide All
  2. Show all
  1. Scallop
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Scallop(args: Seq[String] = immutable.this.Nil, opts: List[CliOption] = immutable.this.Nil, mainOpts: List[String] = immutable.this.Nil, vers: Option[String] = scala.None, bann: Option[String] = scala.None, foot: Option[String] = scala.None, descr: String = "", optionSetValidations: List[(List[String]) ⇒ Either[String, Unit]] = immutable.this.Nil, helpWidth: Option[Int] = scala.None, shortSubcommandsHelp: Boolean = false, subbuilders: List[(String, Scallop)] = immutable.this.Nil)

    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

    optionSetValidations

    Validations, that enforce some rules on groups of options

    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, subcommand: Option[String], subcommandArgs: List[String]) extends Product with Serializable

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

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def addSubBuilder(name: String, builder: Scallop): Scallop

    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.

  7. def apply[A](name: Char)(implicit m: Manifest[A]): A

  8. def apply[A](name: String)(implicit m: Manifest[A]): A

    Get the value of option.

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

    name

    Name for option.

    m

    Manifest for requested type. Usually found implicitly.

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

    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

  10. val args: Seq[String]

    Arguments to parse.

  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. val bann: Option[String]

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

  13. def banner(b: String): Scallop

    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!

  14. def canEqual(arg0: Any): Boolean

    Definition Classes
    Scallop → Equals
  15. def clone(): AnyRef

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

    Short description - used for subcommands

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

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    Scallop → Equals → AnyRef → Any
  19. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  20. def findSubbuilder(name: String): Option[Scallop]

    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.

  21. val foot: Option[String]

    Footer - displayed after options.

  22. def footer(f: String): Scallop

    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!

  23. def get[A](name: Char)(implicit m: Manifest[A]): Option[A]

  24. def get[A](name: String)(implicit m: Manifest[A]): Option[A]

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

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

    name

    Name for option.

    m

    Manifest for requested type. Usually found implicitly.

  25. def getAllSuppliedOptionNames: List[String]

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

  26. final def getClass(): java.lang.Class[_]

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

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

    Find an option, that responds to this short name.

  29. def getSubbuilder: Option[Scallop]

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

  30. def getSubcommandName: Option[String]

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

  31. def getSubcommandNames: List[String]

    Returns the list of subcommand names, recursively.

  32. def hashCode(): Int

    Definition Classes
    Scallop → AnyRef → Any
  33. def help: String

    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 proporties, options and trailing arguments.

  34. val helpWidth: Option[Int]

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

  35. final def isInstanceOf[T0]: Boolean

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

    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

  37. val mainOpts: List[String]

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

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

    Definition Classes
    AnyRef
  39. final def notify(): Unit

    Definition Classes
    AnyRef
  40. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  41. def opt[A](name: String, short: Char, descr: String, default: () ⇒ Option[A], validate: (A) ⇒ Boolean, required: Boolean, argName: String, hidden: Boolean, noshort: Boolean)(implicit conv: ValueConverter[A]): Scallop

    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.

  42. val optionSetValidations: List[(List[String]) ⇒ Either[String, Unit]]

    Validations, that enforce some rules on groups of options

  43. val opts: List[CliOption]

    Options definitions.

  44. def printHelp(): Unit

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

  45. def productArity: Int

    Definition Classes
    Scallop → Product
  46. def productElement(arg0: Int): Any

    Definition Classes
    Scallop → Product
  47. def productIterator: Iterator[Any]

    Definition Classes
    Product
  48. def productPrefix: String

    Definition Classes
    Scallop → Product
  49. def prop[A](name: Char, key: String)(implicit m: Manifest[Map[String, A]]): Option[A]

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

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

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

  52. def setHelpWidth(w: Int): Scallop

    Explicitly sets the needed width for the help printout.

  53. val shortSubcommandsHelp: Boolean

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

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

    subcommands in this builder

  55. def summary: String

    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.

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

    Definition Classes
    AnyRef
  57. def toString(): String

    Definition Classes
    Scallop → AnyRef → Any
  58. def toggle(name: String, default: () ⇒ Option[Boolean] = () => None, short: Char = 0.toChar, noshort: Boolean = false, prefix: String = "no", descrYes: String = "", descrNo: String = "", hidden: Boolean = false): Scallop

  59. def trailArg[A](name: String, required: Boolean, descr: String, default: () ⇒ Option[A], validate: (A) ⇒ Boolean, hidden: Boolean)(implicit conv: ValueConverter[A]): Scallop

    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.

    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

  60. def validationSet(fn: (List[String]) ⇒ Either[String, Unit]): Scallop

    Add a validation for supplied option set.

    Add a validation for supplied option set.

    fn

    A function, that accepts the list of names of options, that are supplied. It should return a Left with error message in case of validation failure.

  61. def verify: Scallop

    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.

  62. val vers: Option[String]

    Version string to display in help.

  63. def version(v: String): Scallop

    Add version string to this builder.

    Add version string to this builder.

    v

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

  64. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def productElements: Iterator[Any]

    Definition Classes
    Product
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) use productIterator instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any