Command line parsing
Jason White via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 14 13:40:18 PDT 2016
On Saturday, 14 May 2016 at 04:34:06 UTC, Andrei Alexandrescu
wrote:
> On 5/13/16 2:27 PM, Russel Winder via Digitalmars-d wrote:
>> On Thu, 2016-05-12 at 18:25 +0000, Jesse Phillips via
>> Digitalmars-d
>> wrote:
>> […]
>>> unknown flags harder and displaying help challenging. So I'd
>>> like
>>> to see getopt merge with another getopt
>>
>> getopt is a 1970s C solution to the problem of command line
>> parsing.
>> Most programming languages have moved on from getopt and
>> created
>> language-idiomatic solutions to the problem. Indeed there are
>> other,
>> better solution in C now as well.
>
> What are those and how are they better? -- Andrei
I wrote what I think is an idiomatic-D command line argument
parser:
https://github.com/jasonwhite/darg
You basically define a struct with your options as members. The
help string is then created at compile time(!). I find this much
cleaner than std.getopt and the usage/help is prettier.
More information about the Digitalmars-d
mailing list