10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-06-17 18:55:18 +02:00
qmcchem/ocaml/qmcchem.ml

37 lines
1.0 KiB
OCaml
Raw Normal View History

2019-07-22 11:31:16 +02:00
let update_command_line () =
2019-07-22 12:19:12 +02:00
let last = (Array.length Sys.argv) - 2 in
Sys.argv.(0) <- Sys.argv.(0) ^ " " ^ Sys.argv.(1);
2019-07-22 11:31:16 +02:00
for i=1 to last do
Sys.argv.(i) <- Sys.argv.(i+1)
done;
2019-07-22 12:19:12 +02:00
Sys.argv.(last+1) <- "--"
2015-12-19 02:35:13 +01:00
2019-07-22 11:31:16 +02:00
let () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");
set_description_doc "Driver for subcommands.";
2019-07-22 12:19:12 +02:00
set_specs []
2019-07-22 11:31:16 +02:00
end;
2019-07-22 12:19:12 +02:00
if Array.length Sys.argv < 2 then
(Command_line.help (); failwith "Inconsistent command line");
2019-07-22 11:31:16 +02:00
2019-07-22 12:19:12 +02:00
let command = Sys.argv.(1) in
2019-07-22 11:31:16 +02:00
update_command_line ();
2019-07-22 12:19:12 +02:00
Command_line.reset ();
2019-07-22 11:31:16 +02:00
match command with
2019-07-22 12:19:12 +02:00
| "debug" -> let open Qmcchem_debug in command ()
| "edit" -> let open Qmcchem_edit in command ()
| "info" -> let open Qmcchem_info in command ()
| "md5" -> let open Qmcchem_md5 in command ()
| "result" -> let open Qmcchem_result in command ()
| "run" -> let open Qmcchem_run in command ()
| "stop" -> let open Qmcchem_stop in command ()
2019-07-22 11:31:16 +02:00
| _ -> (Command_line.help () ; failwith "Inconsistent command line")
2015-12-19 02:35:13 +01:00