[darcs-devel] Darcs Argument Handling

Simon Michael simon at joyful.com
Sat May 10 02:03:38 UTC 2014


On 5/7/14 3:46 PM, Ben Franksen wrote:
>> One result of using
>> an uber-record for all options is that every command now gets every
>> option, even if they cannot use a particular option sensibly.
>
> Right. This is why I am not yet 100% sure it is the right solution. It
> doesn't seem very elegant to pass every possible option to every command. It
> also introduces lots of additional names (all the fields of the record),
> though that can, of course, be controlled via import lists.

FWIW, in hledger I use sort of layered options:

CliOpts    - user-facing command-specific options, plus..
ReportOpts - generic options common to most commands; derived from..
RawOpts    - primitive options (string pairs)

CliOpts are only used in top-level command code, ReportOpts are passed 
around throughout the library code. (And RawOpts exist so that I can 
reuse core hledger's cmdargs modes from separate add-ons.)

It's a bit complicated. I'm very interested to see what you come up 
with. And whether optparse-applicative is ready for prime time.

Thanks for the detailed explanations, they are helpful both for 
spreading the darcs code knowledge and building confidence in your 
changes. I'm not a core developer, but go man go.

-Simon



More information about the darcs-devel mailing list