[Issue 14724] New: std.getopt: config.required breaks --help
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jun 23 09:18:44 PDT 2015
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: nobody at puremagic.com
Reporter: initrd.gz at gmail.com
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)
--
More information about the Digitalmars-d-bugs
mailing list