libphobos/testsuite/libphobos.phobos/std_getopt.d
raw| 1 | @safe unittest |
| 2 | { |
| 3 | import std.getopt; |
| 4 | |
| 5 | auto args = ["prog", "--foo", "-b"]; |
| 6 | |
| 7 | bool foo; |
| 8 | bool bar; |
| 9 | auto rslt = getopt(args, "foo|f", "Some information about foo.", &foo, "bar|b", |
| 10 | "Some help message about bar.", &bar); |
| 11 | |
| 12 | if (rslt.helpWanted) |
| 13 | { |
| 14 | defaultGetoptPrinter("Some information about the program.", |
| 15 | rslt.options); |
| 16 | } |
| 17 | } |
| 18 |