summaryrefslogtreecommitdiff
path: root/libphobos/testsuite/libphobos.phobos/std_getopt.d
blob: 12d81f3878099a686a5b0297787e0022ffe6bb9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@safe unittest
{
    import std.getopt;

    auto args = ["prog", "--foo", "-b"];

    bool foo;
    bool bar;
    auto rslt = getopt(args, "foo|f", "Some information about foo.", &foo, "bar|b",
        "Some help message about bar.", &bar);

    if (rslt.helpWanted)
    {
        defaultGetoptPrinter("Some information about the program.",
            rslt.options);
    }
}