10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-15 02:23:38 +01:00
qmcchem/ocaml/qmcchem.ml

61 lines
1.3 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
2019-07-23 17:27:02 +02:00
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-23 17:27:02 +02:00
Sys.argv.(last+1) <- ""
let help () =
Printf.printf "
qmcchem - QMC=Chem command
Usage:
qmcchem [-h] COMMAND
Arguments:
COMMAND QMC=Chem command to run :
[run|edit|stop|result|md5|info|debug]
Options:
-h --help Prints the help message.
Description:
Driver for subcommands.
"
2015-12-19 02:35:13 +01:00
2019-07-22 11:31:16 +02:00
let () =
2019-07-22 12:19:12 +02:00
if Array.length Sys.argv < 2 then
2019-07-23 17:27:02 +02:00
(help (); failwith "Inconsistent command line") ;
match String.trim Sys.argv.(1) with
| "-h" | "--help" ->
begin
help () ;
exit 0
end
| _ ->
begin
let command =
Sys.argv.(1)
in
update_command_line ();
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 ()
| _ -> (help () ; failwith "Inconsistent command line")
end
2015-12-19 02:35:13 +01:00