darg

Members

Classes

ArgParseError
class ArgParseError

Generic argument parsing exception.

ArgParseHelp
class ArgParseHelp

Thrown when help is requested.

Enums

Config
enum Config

Parsing configuration.

Multiplicity
enum Multiplicity

Multiplicity of an argument.

OptionFlag
enum OptionFlag

An option flag. These types of options are handled specially and never have an argument.

Functions

countArgs
size_t countArgs()

Count the number of positional arguments.

countOpts
size_t countOpts()

Count the number of options.

helpString
string helpString(string description = null)

Constructs a printable help string at compile time for the given options structure.

isLongOption
bool isLongOption(string arg)

Returns true if the given argument is a long option. That is, if it starts with "--".

isOption
bool isOption(string arg)

Returns true if the given argument is an option. That is, it is either a short option or a long option.

isShortOption
bool isShortOption(string arg)

Returns true if the given argument is a short option. That is, if it starts with a '-'.

parseArg
T parseArg(string arg)

Parses an argument.

parseArgs
T parseArgs(const(string[]) arguments, Config config = Config.default_)

Parses options from the given list of arguments. Note that the first argument is assumed to be the program name and is ignored.

usageString
string usageString(string program)

Constructs a printable usage string at compile time from the given options structure.

Structs

Argument
struct Argument

User defined attribute for a positional argument.

Help
struct Help

Help string for an option or positional argument.

MetaVar
struct MetaVar

Meta variable name.

Option
struct Option

User defined attribute for an option.

Meta

Authors

Jason White

Description: Parses arguments.

TODO: - Handle bundled options