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

Tools: use cmdliner library to parse arguments #910

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

aspeddro
Copy link
Contributor

@aspeddro aspeddro commented Feb 3, 2024

Some advantages:

  • Automatically handles syntax errors, help messages and UNIX man page generation
  • Respect most of the POSIX and GNU conventions.
  • cmdliner doesn't have dependencies

There is breaking change bc argument names now start with two dashes --

Other changes

Commands removed:

  • -all-cmt
  • -dce-cmt
  • -exception-cmt
  • -termination-cmt

The four commands above allow you to set the path to the cmt files. Then you could call it as follows without any error:

rescript-tools reanalyze -all-cmt path/one -dce-cmt /path/two

But the path of -dce-cmt overwrites that of -all-cmt. It also doesn't make sense to use -all-cmt and -dce-cmt since -all-cmt reports all types of analysis

Now: A flag for the analysis type, --dce, --exception or --termination. Running command without argument rescript-tools reanalyze will report all kind of analysis.

The argument to cmt path is --cmt-path

rescript-tools reanalyze --cmt-path path/to/cmt

Some Examples

Report all kinds of analysis (no need arg all)

rescript-tools reanalyze

Report only dce

rescript-tools reanalyze --dce

Report only termination

rescript-tools reanalyze --termination

Report exception and termination from custom cmt path

rescript-tools reanalyze --exception --termination --cmt-path path/to/cmt

@aspeddro aspeddro marked this pull request as ready for review February 12, 2024 22:11
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.

2 participants