ae.utils.funopt

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

Public Imports

std.getopt
public static import std.getopt;
Undocumented in source.

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

funoptDispatchUsage
string funoptDispatchUsage()

Constructs the funoptDispatch usage string.

generateManPage
string generateManPage(string programName, string longDescription, string shortDescription, string footer, int section)

Constructs a roff man page based on the funopt usage.

getUsage
string getUsage(string program)

Constructs the funopt usage string.

getUsageFormatString
string getUsageFormatString()

Constructs the funopt usage format string. "%1$s" is used instead of the program name.

optionWrap
string optionWrap(string text, string firstIndent, size_t indentWidth)

Performs line wrapping for option descriptions.

Manifest constants

hiddenOption
enum hiddenOption;

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

Structs

FunOptConfig
struct FunOptConfig

funopt configuration.

_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 <ae@cy.md>