ProgramOptions

You can configure a ProgramOptions object with a number of Options and then use it to parse and array of command line arguments.

The object will generate its member variables from the Options 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.

struct ProgramOptions (
Options...
) if (
Options.length > 0
) {
Optional!(bool delegate(string)) unknownArgHandler;
}

Members

Functions

helpText
string helpText()

Returns a string that represents a block of text that can be output to stdout to display a help message

parse
string[] parse(const string[] args)

Parses the command line arguments according to the set of Options that are passed in. Environment variables are parsed first and then program args second

toString
string toString()

Returns an string that is a map the variable names and their values

Meta