Skip to content
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

Improve cli abstractions #2

Merged
merged 1 commit into from
Sep 14, 2024
Merged

Improve cli abstractions #2

merged 1 commit into from
Sep 14, 2024

Conversation

filipeom
Copy link
Member

@filipeom filipeom commented Sep 12, 2024

Use Cmdliner.Arg.file conv to parse valid files. Cmdliners' file conv already does a Sys.file_exists so we avoid code duplication here.

Also define Mode.t as an algebraic datatype to reduce string allocations and allow for faster instant is_ mode checks.

In a separate PR I'll try to fix CI as well.

PS: My editor removes trailing white space. So, sorry for the big diff! The only relevant changes are in main.ml in the bottom and mode.ml.

Use `Cmdliner.Arg.file` conv to parse valid files. Cmdliners' file
conv already does a `Sys.file_exists` so we avoid code duplication
here.

Also define `Mode.t` as an algebraic datatype to reduce string
allocations and allow for faster instant `is_` mode checks.
@filipeom filipeom requested a review from Th0mz September 12, 2024 17:56
@filipeom filipeom self-assigned this Sep 12, 2024
@filipeom
Copy link
Member Author

Merging to fix the CI in the next PR

@filipeom filipeom merged commit 84cb0a9 into main Sep 14, 2024
0 of 2 checks passed
@filipeom filipeom deleted the improve-cli-abstractions branch September 14, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant