Bug 14724 – std.getopt: config.required breaks --help

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-06-23T16:18:00Z
Last change time
2015-10-04T18:20:20Z
Assigned to
nobody
Creator
initrd.gz

Comments

Comment #0 by initrd.gz — 2015-06-23T16:18:44Z
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)
Comment #1 by rburners — 2015-07-15T09:15:53Z
I will work on that
Comment #2 by rburners — 2015-07-15T09:57:14Z
Comment #3 by github-bugzilla — 2015-08-17T11:29:20Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/6c8b8232c30c38cd2140625225e0b7211a4319ae fix issue14724 some nicer impl https://github.com/D-Programming-Language/phobos/commit/34a7fc52350634fec3590a4dfeb859cd00da6577 Merge pull request #3489 from burner/issue14724 Fix issue 14724 - std.getopt: config.required breaks --help
Comment #4 by github-bugzilla — 2015-10-04T18:20:20Z