ocaml-ppx / ocaml-migrate-parsetree

DEPRECATED. See https://ocaml.org/changelog/2023-10-23-omp-deprecation. Convert OCaml parsetrees between different major versions
Other
87 stars 43 forks source link

Allow not exiting on error, and parse command line from the first argument #84

Closed aantron closed 4 years ago

aantron commented 5 years ago

Fixes #83.

This changes the result type of Driver.run_main and Driver.run_as_ppx_rewriter from 'a to unit, because these functions no longer call exit in all paths unconditionally.

The exit behavior is also changed in a few other ways, even with ~exit_on_error:true:

  1. run_main no longer calls exit 0 at its ends, so execution continues in the caller.
  2. Exit codes are more disciplined. Previously, the exit code was sometimes 1 on Arg.Help, and 1 on Arg.Bad. In the former case, the help message would be printed to STDERR. Now, Arg.Help always prints to STDOUT, and the exit code is 0, and the exit code for Arg.Bad is always 2. This is in accordance with convention and this code in Arg.