-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernize command-line parsing with optparse-applicative #5607
Comments
@mitchellwrosen well for one, there's issue of incurring an additional dependency in lib:Cabal which becomes a ghc boot package -- but we can workaround that by vendoring a subset of optparse-applicative into lib:Cabal More importantly we'd need to figure out if all CLI features we currently have, and those which we intend to have in the future (such as e.g. context-sensitive tab-completion, whose competition candidates are retrieved lazily on-demand; e.g. consider |
I've entertained a similar thought, but I shelved it because of the backwards-compatibility concerns. We'd want a really, really thorough test-suite for command-line parsing to feel comfortable, I think, so that would be a first step to moving towards a different parsing library. (Besides all the usefulness of more tests catching regressions early and all that.) |
@hvr I'm not 100% positive @quasicomputational Good point, extensively testing the existing CLI would be the first step to refactoring it. |
Note that this would also fix #1257. |
Would this really incur additional boot dependencies? AIUI GHC needs |
The cli parsing is a mess. cabal-install's is bolted on top of Cabal's. They literally share the same types. |
FWIW Isn't it time to bury |
Cf. #9107 (comment) |
I want to extend on the idea I mentioned in passing on Reddit before (the crossed out part of my comment here). There are roughly three ways to parse commandline options in Haskell as we know it:
The end goal would be for each component to have a completely pure, completely separate Haskell datatype which it uses as an input. The resulting parser can sit in
If It would make sense if |
After reading through System.Console.GetOpt it turned out |
Is there any interest in replacing the
System.Console.GetOpt
code with a more modernoptparse-applicative
style options parser? If so, hm - maybe I'll take a stab. It could be a lot of work for little benefit, unless the existing options parsing code is slowing people down.The text was updated successfully, but these errors were encountered: