From ad2569c6c233de69f55b4c22ed9b79b5e8627738 Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Sat, 25 Oct 2025 00:05:50 +0900 Subject: [PATCH] Cmdliner v2 Signed-off-by: Sora Morimoto --- compiler/bin-jsoo_minify/jsoo_minify.ml | 4 +++- compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml | 4 +++- dune-project | 4 ++-- js_of_ocaml-compiler.opam | 2 +- wasm_of_ocaml-compiler.opam | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/compiler/bin-jsoo_minify/jsoo_minify.ml b/compiler/bin-jsoo_minify/jsoo_minify.ml index f636ab50e0..b9343dd1f7 100644 --- a/compiler/bin-jsoo_minify/jsoo_minify.ml +++ b/compiler/bin-jsoo_minify/jsoo_minify.ml @@ -91,7 +91,7 @@ let main = let t = Cmdliner.Term.(const f $ Cmd_arg.options) in Cmdliner.Cmd.v Cmd_arg.info t -let (_ : int) = +let exit_code = try Cmdliner.Cmd.eval ~catch:false ~argv:Sys.argv main with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in @@ -108,3 +108,5 @@ let (_ : int) = | exc -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); exit 1 + +let () = exit exit_code diff --git a/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml b/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml index 1192fbe17d..fb09593e98 100644 --- a/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml +++ b/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml @@ -19,7 +19,7 @@ open Js_of_ocaml_compiler.Stdlib -let (_ : int) = +let exit_code = try Cmdliner.Cmd.eval ~catch:false ~argv:Sys.argv Link_wasm.command with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in @@ -36,3 +36,5 @@ let (_ : int) = | exc -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); exit 1 + +let () = exit exit_code diff --git a/dune-project b/dune-project index 45b9ce66de..d19e37b39d 100644 --- a/dune-project +++ b/dune-project @@ -23,7 +23,7 @@ (ppxlib (>= 0.35)) (ocaml-compiler-libs (>= v0.12.4)) (re :with-test) - (cmdliner (>= 1.1.0)) + (cmdliner (>= 2.0)) (sedlex (>= 3.3)) (qcheck :with-test) menhir @@ -143,7 +143,7 @@ (ppx_expect (and (>= v0.14.2) :with-test)) (ppxlib (>= 0.35)) (re :with-test) - (cmdliner (>= 1.1.0)) + (cmdliner (>= 2.0)) (opam-format :with-test) (sedlex (>= 2.3)) menhir diff --git a/js_of_ocaml-compiler.opam b/js_of_ocaml-compiler.opam index 4d3cbdde9c..158fc2a779 100644 --- a/js_of_ocaml-compiler.opam +++ b/js_of_ocaml-compiler.opam @@ -19,7 +19,7 @@ depends: [ "ppxlib" {>= "0.35"} "ocaml-compiler-libs" {>= "v0.12.4"} "re" {with-test} - "cmdliner" {>= "1.1.0"} + "cmdliner" {>= "2.0"} "sedlex" {>= "3.3"} "qcheck" {with-test} "menhir" diff --git a/wasm_of_ocaml-compiler.opam b/wasm_of_ocaml-compiler.opam index 1a2af784a3..76d7ce5165 100644 --- a/wasm_of_ocaml-compiler.opam +++ b/wasm_of_ocaml-compiler.opam @@ -19,7 +19,7 @@ depends: [ "ppx_expect" {>= "v0.14.2" & with-test} "ppxlib" {>= "0.35"} "re" {with-test} - "cmdliner" {>= "1.1.0"} + "cmdliner" {>= "2.0"} "opam-format" {with-test} "sedlex" {>= "2.3"} "menhir"