Rewrite command line processing with optparse-applicative?
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.
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?
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...
You can also just introduce a space for those options :)
@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.
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.
Can this issue be closed now? Since the pull request of @klrr ?