View source code
Display the source code in std/getopt.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Module std.getopt
Processing of command line options.
The getopt
module implements a
function, which adheres to
the POSIX syntax for command line options. GNU extensions are
supported in the form of long options introduced by a double dash
("--"). Support for bundling of command line options, as was the case
with the more traditional single-letter approach, is provided but not
enabled by default.
getopt
Credits
This module and its documentation are inspired by Perl's Getopt::Long module. The syntax of
D's
is simpler than its Perl counterpart because getopt
infers the expected parameter types from the static types of
the passed-in pointers.
getopt
Functions
Name | Description |
---|---|
defaultGetoptFormatter
|
This function writes the passed text and into an output range
in the manner, described in the documentation of function
.
|
defaultGetoptPrinter
|
This function prints the passed and text in an aligned manner.
|
getopt
|
Parse and remove command line options from an string array. |
Classes
Name | Description |
---|---|
GetOptException
|
Thrown on one of the following conditions:
|
Structs
Name | Description |
---|---|
GetoptResult
|
The result of the function.
|
Option
|
The result of the getoptHelp function.
|
Enums
Name | Description |
---|---|
config
|
Configuration options for .
|
Global variables
Name | Type | Description |
---|---|---|
arraySep
|
string
|
The string used to separate the elements of an array or associative array (default is "" which means the elements are separated by whitespace). |
assignChar
|
dchar
|
The assignment character used in options with parameters (default '='). |
endOfOptions
|
string
|
The string that conventionally marks the end of all options (default '--'). |
optionChar
|
dchar
|
The option character (default '-'). |