ae.utils.funopt

Translate command-line parameters to a function signature, generating --help text automatically.

Members

Functions

defaultUsageFun
void defaultUsageFun(string usage)

Default help text print function. Sends the text to stderr.writeln.

funopt
auto funopt(string[] args)

Parse the given arguments according to FUN's parameters, and call FUN. Throws GetOptException on errors.

funoptDispatch
auto funoptDispatch(string[] args)

Dispatch the command line to a type's static methods, according to the first parameter on the given command line (the "action"). String UDAs are used as usage documentation for generating --help output (or when no action is specified).

Manifest constants

hiddenOption
enum hiddenOption;

Specify this as the description to hide the option from --help output.

Templates

Option
template Option(T, string description = null, string placeholder = null, char shorthand = 0, string name = null)

An option with a value (e.g. --tries N). The default placeholder depends on the type (N for numbers, STR for strings).

Parameter
template Parameter(T, string description = null, string name = null)

An ordered parameter.

Switch
template Switch(string description = null, char shorthand = 0, string name = null)

An on/off switch (e.g. --verbose). Does not have a value, other than its presence.

Meta

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.