Struct ProgramOptions
You can configure a ProgramOptions
object with a number of Option
s and then use it to parse
and array of command line arguments.
struct ProgramOptions(_Options...)
;
The object will generate its member variables from the Option
s you pass in, for e.g.
auto opts = ProgramOptions!(Option!("one", int), Option!("two", string[]));
static assert(is(typeof(opts .one) == int));
static assert(is(typeof(opts .two) == string[]));
All the member varibles will have their init
values unless you specify a defaultValue
for
an Option
.
Methods
Name | Description |
---|---|
helpText
|
Returns a string that represents a block of text that can be output to stdout to display a help message |
parse
|
Parses the command line arguments according to the set of Option s that are passed in.
Environment variables are parsed first and then program args second
|
toString
|
Returns an string that is a map the variable names and their values |
Parameters
Name | Description |
---|---|
_Options | 1 or more Option objects, each representing one command line argument |