obsolete D libraries/modules

Jacob Carlborg doob at me.com
Mon Sep 2 00:37:25 PDT 2013


On 2013-09-02 07:58, Jonathan M Davis wrote:

> If we had a nice list of getopt's quirks that should arguably be fixed, then we
> can look at creating a getOpt function with the improved behavior, but I think
> that that's very different from actually coming up with a new API, which is
> what would be required for some of the changes that some people want (like
> automatically generating --help), and that's what I think would be quite
> difficult to do cleanly. What we have is very close to ideal IMHO. It just needs
> a few tweaks.

I don't see why the API needs to be changed to support automatically 
generating help messages. Extended yes, but not changed.

This is a simple idea:

uint timeout;
getopt(args, "timeout|t", &timeout).help("Set the timeout");

This interface assumes you can call "getopt" multiple times and call 
"getopt" once per flag.

Alternatively pass in some form of options struct or similar:

struct Options
{
     string help;
}

auto options = Options("Set the timeout");

uint timeout;
getopt(args, "timeout|t", &timeout, options);

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list