www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21057] New: getopt, function setter for a long option receive


          Issue ID: 21057
           Summary: getopt, function setter for a long option receive the
                    key, not the value
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

Not sure if it is a major one, considering that nobody has reported it yet but
this the setter for a long option is called with the wrong part of the option,
e.g for "--key=value" the setter is called with "key":

void setValue(string value)
    assert(value == value.stringof, value);

void main(string[] args)
    args ~= "--key=value";
    import std.getopt;
    getopt(args, "key", &setValue);

unless i handle the fix by myself, open a PR in for the stable branch please.

Jul 19 2020