On 5/14/16 4:40 PM, Jason White wrote:
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.
This is a terrific use of properties and it's a bit of a bummer
std.getopt predates them. Thanks for an inspirational package. We should
integrate some of these ideas in std.getopt and beyond.
One simple step up for your package would be to do away with the
enclosing struct - it can stay optional, but there's no real need for it.
Andrei