From b7964befd039c41c63e00ef323f9eb49061c144c Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sun, 1 Oct 2023 19:30:58 +0200 Subject: Added the git revision in the code --- bin/dune | 4 +++- bin/qsp_parser.ml | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/dune b/bin/dune index f7aacc3..58e96ff 100644 --- a/bin/dune +++ b/bin/dune @@ -4,7 +4,9 @@ (libraries sedlex qsp_syntax - qparser) + qparser + tools + ) (preprocess (pps ppx_deriving.show diff --git a/bin/qsp_parser.ml b/bin/qsp_parser.ml index fb0c1c8..32e7a2f 100644 --- a/bin/qsp_parser.ml +++ b/bin/qsp_parser.ml @@ -21,6 +21,12 @@ module Args = struct let speclist = [ + ( "--version", + Arg.Unit + (fun () -> + Printf.printf "Version %s\n" Tools.Git_hash.revision; + exit 0), + "Display the version of the application and exit" ); ("--level", Arg.String level, "Message level [debug, warn, error]"); ( "--global", Arg.Set reset_line, @@ -64,12 +70,12 @@ let parse_location : Qparser.Lexbuf.t -> filters -> unit = | [] -> () | _ -> let start_position, _ = Qparser.Lexbuf.positions lexbuf in - Format.fprintf Format.std_formatter "Location %s@;@[%a@]@." + Format.fprintf Format.std_formatter "Location@ %s@;@[%a@]@." start_position.Lexing.pos_fname pp_result report; ()) | Error e -> let start_position, _ = Qparser.Lexbuf.positions lexbuf in - Format.fprintf Format.std_formatter "Location %s@;@[%a]@." + Format.fprintf Format.std_formatter "Location@ %s@;@[%a]@." start_position.Lexing.pos_fname Report.pp e let () = -- cgit v1.2.3