VersionSpecificApi
Type members
Inherited classlikes
A simple command line argument parser.
A simple command line argument parser.
Usage:
-
Define parameters with param, requiredParam, repeatedParam and command. Each of these methods gives back a handle to a future argument value.
-
Call
parse()
with actual arguments. -
If parsing succeeds, the arguments will be available in the handles defined in step 1.
If parsing fails, error descriptions are printed and the program exits
with 2. (This behaviour may be changed by subclassing and redefining the
check()
method).
Example
val parser = argparse.ArgumentParser("0.1.0")
val p1 = parser.param[String]("--this-is-a-named-param", default = "default value")
val p2 = parser.param[Int]("positional-param", default = 2)
parser.parse(Seq("--this-is-a-named-param=other", 5)) println(p1())
println(p2())
- Value Params
- description
a short description of this command. Used in help messages.
- enableHelpFlag
include a
--help
flag which will print a generated help message
- Inherited from
- ParsersApi
A typeclass that defines how to convert a string from a single command line argument to a given type.
A typeclass that defines how to convert a string from a single command line argument to a given type.
- Inherited from
- TypesApi
Value members
Inherited methods
The name of the flag to use for generating standalone bash-completion.
The name of the flag to use for generating standalone bash-completion.
Set this to the empty string to disable bash-completion entirely.
- Inherited from
- ParsersApi
Generate a help message from parameters.
Generate a help message from parameters.
This message will be used by ArgumentParsers. Overriding this allows you to customize the help message of all ArgumentParsers.
- Inherited from
- ParsersApi