Idris-dev icon indicating copy to clipboard operation
Idris-dev copied to clipboard

Rewrite command line processing with optparse-applicative?

Open trillioneyes opened this issue 12 years ago • 6 comments

Currently the command line processing is done with a custom function that is written by pattern matching on lists of strings. This is hard to get right and leads to issues like #593 and #849. It would be nice if we could rewrite this to use a command line parsing library. I would be willing to do this myself, but since it's a bit larger a project than I've done before, I just wanted to see if anyone had any thoughts on the matter.

trillioneyes avatar Feb 14 '14 20:02 trillioneyes

Great idea! I don't know the details of that particular package, but a structured approach is almost certainly better.

I think @jfdm was working on this earlier - ping him perhaps?

david-christiansen avatar Feb 14 '14 21:02 david-christiansen

I haven't extensively studied optparse-applicative either, but I think it should be pretty straightforward. The only thing that stopped me last time I contemplated this was that I couldn't see how to handle things like -XExtension that aren't space-separated but are conceptually two separate things (-X introducing the option and then an extension name). I'll look more closely soon...

trillioneyes avatar Feb 14 '14 21:02 trillioneyes

You can also just introduce a space for those options :)

david-christiansen avatar Feb 14 '14 21:02 david-christiansen

@trillioneyes the has been some discussion on rewriting the interface to use a non-custom command line parsing library. There was some discussion on the mailing list, and I did start work on a feature branch:

https://github.com/jfdm/Idris-dev/tree/feature/cmdargs-parser

However, the options run deep within the Idris source and AST, and the split between option parsing and use was not clean enough to do a straight swap. I am quite happy to consult on this, as I do not have enough time to work on doing a port myself.

jfdm avatar Feb 24 '14 08:02 jfdm

I've started working on this here: https://github.com/klrr/Idris-dev/tree/fix/master/cmd-args

Currently I'm just redoing @jfdm's changes but using latest sources since his last commit is 4 months old.

funrep avatar May 01 '14 15:05 funrep

Can this issue be closed now? Since the pull request of @klrr ?

jfdm avatar Jun 05 '14 08:06 jfdm