[fpc-pascal] CLI argument parsers (was: Resource compilation)

Martok listbox at martoks-place.de
Mon Jan 14 00:56:12 CET 2019


Am 13.01.2019 um 18:43 schrieb Michael Van Canneyt:
> Assuming you mean the command-line arguments:
> 
> What's wrong/missing with the functionality in TCustomApplication ?
Other than that nobody in the wild seems to fully use it? ;-)
Even most of the examples in the compiler tree use homegrown parsers, or look
like [1].

I'm a fan of getopts and use it (with a small wrapper) for almost everything (i.
[2]), but it seems that many people are not aware it even exists. It's even
POSIX compliant, so the program's users won't be surprised by some
implementation particulars.
But even that is nowhere near as elegant as argparse. I just don't like retyping
usage statements when they could be autogenerated ;-)
And Subparsers are, while possible, always quite hacky.

Of course, if someone was to implement something now, we'd be in the
https://xkcd.com/927/ situation...


[1] https://github.com/graemeg/freepascal/blob/master/utils/svn2cvs/svn2cvs.pp#L494
[2] https://github.com/martok/buildtools/blob/master/buildutil.lpr

-- 
Regards,
Martok




More information about the fpc-pascal mailing list