From 3cb2c5f4ed82bfae91c82ee912f763af8432d616 Mon Sep 17 00:00:00 2001 From: Michele Alberti <michele.alberti@cea.fr> Date: Thu, 24 Nov 2022 12:28:55 +0100 Subject: [PATCH] [cmdline] Use cmdliner converter for regular result type. --- src/main.ml | 2 +- src/verification.ml | 6 +++--- src/verification.mli | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.ml b/src/main.ml index 843aa75..5b94405 100644 --- a/src/main.ml +++ b/src/main.ml @@ -229,7 +229,7 @@ let verify_cmd = let term = let files = let doc = "File to verify." in - let file_or_stdin = Verification.File.(of_string, pretty) in + let file_or_stdin = Arg.conv' Verification.File.(of_string, pretty) in Arg.(non_empty & pos_all file_or_stdin [] & info [] ~doc ~docv:"FILE") in let prover = diff --git a/src/verification.ml b/src/verification.ml index c802ac8..693ee84 100644 --- a/src/verification.ml +++ b/src/verification.ml @@ -48,10 +48,10 @@ module File = struct let of_string s = if String.equal s "-" - then `Ok Stdin + then Ok Stdin else if Caml.Sys.file_exists s - then `Ok (File s) - else `Error (Fmt.str "no '%s' file or directory" s) + then Ok (File s) + else Error (Fmt.str "no '%s' file or directory" s) let pretty fmt = function | Stdin -> Fmt.string fmt "-" diff --git a/src/verification.mli b/src/verification.mli index d1f2186..b9a262b 100644 --- a/src/verification.mli +++ b/src/verification.mli @@ -38,7 +38,7 @@ module File : sig type t val of_json_config : json_config -> t - val of_string : string -> [ `Ok of t | `Error of string ] + val of_string : string -> (t, string) result val pretty : Format.formatter -> t -> unit end -- GitLab