import std.stdio, std.getopt; enum Foo { bar, baz } void main(string[] args) { Foo foo; getopt(args, "foo", &foo); writeln(foo); } $ dmd test.d $ ./test --foo barThatIDrinkAt bar
https://github.com/D-Programming-Language/phobos/pull/1902