https://issues.dlang.org/show_bug.cgi?id=14724
Issue ID: 14724
Summary: std.getopt: config.required breaks --help
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
Specifying a required argument to getopt causes `prog --help` to fail with an
error saying that the required argument was missing.
Example program:
import std.getopt;
void main(string[] args) {
string filename;
auto helpinfo = getopt(args,
std.getopt.config.required, "filename", "A file to read", &filename,
);
if(helpinfo.helpWanted) {
defaultGetoptPrinter("I am help text", helpinfo.options);
}
}
$ rdmd test.d --help
std.getopt.GetOptException@/usr/include/dmd/phobos/std/getopt.d(572): Required
option filenamewas not supplied
----------------
...
(there's also a typo in the error message, but I submitted a pull request to
fix it awhile ago and it was accepted)
--