rescript-vscode icon indicating copy to clipboard operation
rescript-vscode copied to clipboard

Tools: use `cmdliner` library to parse arguments

Open aspeddro opened this issue 1 year ago • 0 comments

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 avatar Feb 03 '24 20:02 aspeddro