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, helpFormatter: ScallopHelpFormatter = new ScallopHelpFormatter, subbuilders: List[(String, Scallop)] = Nil) extends ScallopArgListLoader with 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
- Alphabetic
- By Inheritance
- Scallop
- Serializable
- Serializable
- Product
- Equals
- ScallopArgListLoader
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
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, helpFormatter: ScallopHelpFormatter = new ScallopHelpFormatter, subbuilders: List[(String, Scallop)] = 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
- 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
- case class ParseResult(opts: Parsed = Nil, subcommand: Option[String] = None, subcommandArgs: List[String] = Nil) extends Product with Serializable
- type Parsed = List[(CliOption, (String, List[String]))]
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addSubBuilder(nameAndAliases: Seq[String], builder: Scallop): Scallop
Adds a subbuilder (subcommand) to this builder.
- val appendDefaultToDescription: Boolean
- def apply(name: Char): Any
-
def
apply(name: String): Any
Get the value of option.
Get the value of option. If option is not found, this will throw an exception.
- name
Name for option.
-
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
- val args: Seq[String]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val bann: Option[String]
-
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!
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- val descr: String
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
filteredSummary(blurred: Set[String]): String
Get summary of current parser state + blurring the values of parameters provided.
Get summary of current parser state + blurring the values of parameters provided.
- blurred
names of arguments that should be hidden. Returns a list of all options in the builder, and corresponding values for them with eventually blurred values.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
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.
- val foot: Option[String]
-
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!
- def get(name: Char): Option[Any]
-
def
get(name: String): Option[Any]
Get the value of option (or trailing arg) as Option.
Get the value of option (or trailing arg) as Option.
- name
Name for option.
-
def
getAllSuppliedOptionNames: List[String]
Retrieves a list of all supplied options (including options from subbuilders).
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- lazy val getHelpOption: CliOption
- def getOptionShortNames(opt: CliOption): List[Char]
-
def
getOptionWithShortName(c: Char): Option[CliOption]
Find an option, that responds to this short name.
-
def
getSubbuilder: Option[Scallop]
Retrieves the subbuilder object, that matches the name of the subcommand found in input arguments.
-
def
getSubcommandArgs: List[String]
Returns the subcommand arguments.
-
def
getSubcommandName: Option[String]
Retrieves name of the subcommand that was found in input arguments.
-
def
getSubcommandNames: List[String]
Returns the list of subcommand names, recursively.
- lazy val getVersionOption: Option[CliOption]
-
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 properties, options and trailing arguments.
- val helpFormatter: ScallopHelpFormatter
- val helpWidth: Option[Int]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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
-
def
loadArgList(args: Seq[String]): Seq[String]
- Definition Classes
- ScallopArgListLoader
- val mainOpts: List[String]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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
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.
-
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
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.
- val opts: List[CliOption]
- var parent: Option[Scallop]
-
def
printHelp(): Unit
Print help message (with version, banner, option usage and footer) to stdout.
- def prop(name: Char, key: String): Option[Any]
-
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".
- def propsLong[A](name: String, descr: String = "", keyName: String = "key", valueName: String = "value", hidden: Boolean = false)(implicit conv: ValueConverter[Map[String, A]]): Scallop
-
def
setHelpWidth(w: Int): Scallop
Explicitly sets the needed width for the help printout.
- val shortSubcommandsHelp: Boolean
- val subbuilders: List[(String, Scallop)]
-
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.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
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
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.
-
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
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
-
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.
- val vers: Option[String]
-
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.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )