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).

getUsage
string getUsage(string program)
Undocumented in source. Be warned that the author may not have intended to support it.
getUsageFormatString
string getUsageFormatString()
Undocumented in source. Be warned that the author may not have intended to support it.
optionWrap
string optionWrap(string text, string firstIndent, size_t indentWidth)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

hiddenOption
enum hiddenOption;

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

Structs

FunOptConfig
struct FunOptConfig
Undocumented in source.
OptionImpl
struct OptionImpl(OptionType type_, T_, string description_, char shorthand_, string placeholder_, string name_)
Undocumented in source.

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

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/.

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>