[Issue 11737] Allow optional string value for getopt switches

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 15 11:24:14 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11737



--- Comment #4 from Andrei Alexandrescu <andrei at erdani.com> 2013-12-15 11:24:12 PST ---
Upon a bit more thinking, the trick is rather subtle. Perhaps it would be more
straightforward to allow two lambdas with the same option, and invoke the
appropriate one.

import std.getopt;
import std.stdio;

void main(string[] args)
{
    getopt(args,
           "log",
           (string option)  // should allow '--log'
           {
           },
           "log",
           (string option, string value)  // should allow '--log=value'
           {
           });
);
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list