On 2013-09-01 04:29, Jonathan M Davis wrote:

std.getopt is definitely lacking some nice-to-have features (like automatically
generating --help from the options), but for the most part, I don't think that
it can be improved much without seriously complicating it. I think that it's
about at the limit of what can be done and still have it be simple, and it
works really well for the most part, so if we haven't hit the sweet spot,
we're at least close. I've toyed with trying to figure out how to improve it,
but I think that doing so cleanly would be very hard.

I don't know if you're referring to the API or the implementation. But if you're referring to the API I think something like this could be made to work:

string outputFile;
getopt(args, "output", &outputFile).min(2).max(4).restrict("a", "b", "c", "d");

The current API stays exactly the same, it's just extended. This assumes it's possible to call "getopt" multiple times and you setup one argument per call, unless you want the same restrictions for multiple arguments.

--
/Jacob Carlborg

Reply via email to