qmcchem/ocaml/qmcchem.ml

37 lines
1.0 KiB
OCaml

let update_command_line () =
let last = (Array.length Sys.argv) - 2 in
Sys.argv.(0) <- Sys.argv.(0) ^ " " ^ Sys.argv.(1);
for i=1 to last do
Sys.argv.(i) <- Sys.argv.(i+1)
done;
Sys.argv.(last+1) <- "--"
let () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");
set_description_doc "Driver for subcommands.";
set_specs []
end;
if Array.length Sys.argv < 2 then
(Command_line.help (); failwith "Inconsistent command line");
let command = Sys.argv.(1) in
update_command_line ();
Command_line.reset ();
match command with
| "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 ()
| _ -> (Command_line.help () ; failwith "Inconsistent command line")