Option

Represents one program options. One of more of these can be given to a ProgramOptions object as template arguments.

template Option (
string varName
T
) {}

Parameters

varName

The name of the variable that will hold the value of the option. This value represents the default long name of the program option.

T

The type of this variable

Named optional arguments

A number of named optional arguments can be given to an Option for e.g.:

ProgramOptions!(
    Option!("optionName", bool).shortName!"o";
);

This will create an options object that can parse --optionName and -o on the command line.

The following named optional arguments are available:

<li>shortName: string - the short name for the option <li>longName: string - the long name of the option if different from the variable name <li>defaultValue: T - the default value if not supplied <li>description: string - description for help message <li>environmentVar: string - the name of the envrionemtn var that can set this option if present <li>caseSensitiveLongName: bool - true if long name is case sensitive <li>caseSensitiveShortName: bool - true if short name is case sensitive <li>incremental: bool - true if this option represents an incremental value <li>validator: bool function(T) - a function that will be given the value and must return true if the value is valid <li>seperator: string - the seperator used to parse associative array values <li>parser: T function(string) - a function that must return a T after parsing the string <li>bundleable: bool - true if this short option can be bundled with other short options <li>duplicatePolicy: OptionDuplicatePolicy - what to do when the option is encoutered for a second time

Meta