Example:
auto args = docopt(DOC, argv);
string file = args["<file>"].as!string;
bool verbose = args["--verbose"].as!bool;
int count = args["--count"].as!int;
const(string[]) files = args["<file>"].as!(const(string[]));T as(T)() if (is(T == string) || is(T == bool) || is(T == int) || is(T == long) || is(T == double) || is(T == float) || is(
T == const(string[]))) const @safe pure nothrow @nogcReturns the value converted to the specified type.
This template method provides idiomatic D-style type conversion, similar to other D libraries. Supported types are:
string - returns the string value or nullbool - returns the boolean value or falseint - returns the integer value or 0long - returns the long value or 0Ldouble - returns the double value or 0.0float - returns the float value or 0.0fconst(string[]) - returns the list value or nullT | The target type to convert to. |
Example:
auto args = docopt(DOC, argv);
string file = args["<file>"].as!string;
bool verbose = args["--verbose"].as!bool;
int count = args["--count"].as!int;
const(string[]) files = args["<file>"].as!(const(string[]));