[Issue 16684] std.getopt, problem with the automatic handling of "h"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 21 02:16:57 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=16684

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
This is a regression.

Simplified test case:

/////////////// test.d ///////////////
void main()
{
    import std.getopt;

    string[] args = ["program", "-h"];
    getopt(args, config.passThrough);
    assert(args == ["program", "-h"]);
}
//////////////////////////////////////

Introduced in https://github.com/dlang/phobos/pull/2072

(In reply to b2.temp from comment #1)
> @Alexandru, I think that the best fix is to
> 
> 1/ add a static assert() that prevents to specify "-h" or "--help"  (for
> example there's already "optionValidator" that does a few static checks) 

What if I want to generate my own help screen? E.g. if I'm using a library
around std.getopt that generates its own enhanced help screen (e.g.
ae.utils.funopt).

--


More information about the Digitalmars-d-bugs mailing list