Module B00_cli.Exit

Program exits.

Common exit codes

val ok : B00_std.Os.Exit.t

ok is the zero exit code.

val no_such_name : B00_std.Os.Exit.t

no_such_name (122) indicates a named entity was not found.

val some_error : B00_std.Os.Exit.t

some_error (123) indicates an indiscriminate error reported on stdout.

val infos : Cmdliner.Term.exit_info list

infos has the infos of Cmdliner.Term.default_exits, no_such_name, some_error and those above.

Evaluating and exiting

val of_eval_result : ?⁠term_error:B00_std.Os.Exit.t -> B00_std.Os.Exit.t Cmdliner.Term.result -> B00_std.Os.Exit.t

of_eval_result ~term_error r is:

  • e if r is Ok e
  • Code c otherwise with c defined by using Term.exit_status_of_status_result using term_error for term errors or Term.exit_status_cli_error if unspecified.
val exit : exec_error:B00_std.Os.Exit.t -> B00_std.Os.Exit.t -> 'a

exit e exits with e. This uses B00_std.Os.Exit.exit and in case of Error _ logs it and exits with exec_error which if given an exit code is then guaranteed to exit.