Command line parsing
Jon D via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 14 12:25:54 PDT 2016
On Saturday, 14 May 2016 at 13:17:05 UTC, Andrei Alexandrescu
wrote:
>
> I showed a fellow programmer std.getopt. We were both on
> laptops. He wanted to show me how good Python's argparse is and
> how D should copy it. By the end of the chat it was obvious
> argparse was much more verbose and less pleasant to use than
> getopt. Like you have to create an object (?!?!) to parse the
> command line and many other lines of nonsense.
>
I've found D's getopt package to be pretty good. There are a
number of small things that could make it quite a bit better. To
me these generally appear more the result of limited usage rather
than anything fundamentally wrong with the design.
For example, error text produced when a run-time argument doesn't
match the option spec is often not helpful to the user who
entered the command, and I've found I need to take steps to
address this. A package like Perl's Getopt::Long tends to a bit
more mature in some of these details.
--Jon
More information about the Digitalmars-d
mailing list