Refactor CLI argument parsing
Working towards #391.
I wanted to open this to get feedback on the approach.
I could have chosen to use exceptions, but I find sealed classes much more composable and I already anticipate adding another class to the ParseResult hierarchy to represent a situation where a message needs to be shown to the user but isn't an error (--help is the obvious example).
Closes #465 more or less as a side-effect.
Hi @grodin!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Forgot to sign the CLA before opening this, done now
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
I overall loved the direction things are going, keep it up! 👍
Just a few minor comments, but nothing serious. Let me know if you want to push this already and proceed with another PR or just build on top of this one.
I overall loved the direction things are going, keep it up! 👍
Just a few minor comments, but nothing serious. Let me know if you want to push this already and proceed with another PR or just build on top of this one.
Probably worth separating them out into separate PRs. I've got some more nearly ready once this is merged.
Some of this is formatted with ktfmt, some isn't, but you said you'd handle that when you merge it internally, so I'll leave that to you.
In case you are not going to work on it this week, let's start merging this already, you could make other changes in other PRs.
@hick209 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
In case you are not going to work on it this week, let's start merging this already, you could make other changes in other PRs.
Sorry, had a very busy period at home and on top of that, drive failure in my laptop, so I've not been able to work on this much. I am still very much intending to get more done on ktfmt, hopefully end of this week, definitely more next.
No problem @grodin, I completely understand. I went ahead and did some modifications to it and will merge this PR now. Feel free to submit some more 😃
Thanks a ton for your contributions, we're really grateful for that.
@hick209 merged this pull request in facebook/ktfmt@26a24aea73043e7f342a040015ab3b73657baf3d.