Skip to content
Snippets Groups Projects
Commit fa582037 authored by Michele Alberti's avatar Michele Alberti
Browse files

Rework and prepare cmdline to accept new command.

parent 497f8208
No related branches found
No related tags found
No related merge requests found
...@@ -158,7 +158,7 @@ let config_cmd = ...@@ -158,7 +158,7 @@ let config_cmd =
ret ret
(const (fun detect _ -> (const (fun detect _ ->
if not detect if not detect
then `Help (`Pager, Some "config") then `Help (`Pager, Some cmdname)
else else
(* TODO: Do not only check for [detect], and enable it by default, (* TODO: Do not only check for [detect], and enable it by default,
as soon as other options are available. *) as soon as other options are available. *)
...@@ -167,47 +167,43 @@ let config_cmd = ...@@ -167,47 +167,43 @@ let config_cmd =
in in
Cmd.v info term Cmd.v info term
let memlimit =
let doc =
"Memory limit. $(docv) is intended in megabytes (MB) by default, but \
gigabytes (GB) and terabytes (TB) may also be specified instead."
in
Arg.(
value & opt (some string) None & info [ "m"; "memlimit" ] ~doc ~docv:"MEM")
let timelimit =
let doc =
"Time limit. $(docv) is intended in seconds (s) by default, but minutes \
(m) and hours (h) may also be specified instead."
in
Arg.(
value & opt (some string) None & info [ "t"; "timelimit" ] ~doc ~docv:"TIME")
let format =
let doc = "File format." in
Arg.(value & opt (some string) None & info [ "format" ] ~doc)
let loadpath =
let doc = "Additional loadpath." in
Arg.(value & opt_all string [ "." ] & info [ "L"; "loadpath" ] ~doc)
let verify_cmd = let verify_cmd =
let cmdname = "verify" in let cmdname = "verify" in
let doc = "Property verification using external provers." in
let info = let info =
let doc = "Property verification using external provers." in
Cmd.info cmdname ~sdocs:Manpage.s_common_options ~exits:Cmd.Exit.defaults Cmd.info cmdname ~sdocs:Manpage.s_common_options ~exits:Cmd.Exit.defaults
~doc ~doc
~man:[ `S Manpage.s_description; `P doc ] ~man:[ `S Manpage.s_description; `P doc ]
in in
let term = let term =
let files = let files =
let doc = "Files to verify." in let doc = "File to verify." in
let file_or_stdin = Verification.File.(of_string, pretty) in let file_or_stdin = Verification.File.(of_string, pretty) in
Arg.(value & pos_all file_or_stdin [] & info [] ~doc) Arg.(non_empty & pos_all file_or_stdin [] & info [] ~doc ~docv:"FILE")
in
let format =
let doc = "File format." in
Arg.(value & opt (some string) None & info [ "format" ] ~doc)
in
let loadpath =
let doc = "Additional loadpath." in
Arg.(value & opt_all string [ "." ] & info [ "L"; "loadpath" ] ~doc)
in
let memlimit =
let doc =
"Memory limit. $(docv) is intended in megabytes (MB) by default, but \
gigabytes (GB) and terabytes (TB) may also be specified instead."
in
Arg.(
value
& opt (some string) None
& info [ "m"; "memlimit" ] ~doc ~docv:"MEM")
in
let timelimit =
let doc =
"Time limit. $(docv) is intended in seconds (s) by default, but \
minutes (m) and hours (h) may also be specified instead."
in
Arg.(
value
& opt (some string) None
& info [ "t"; "timelimit" ] ~doc ~docv:"TIME")
in in
let prover = let prover =
let all_provers = Prover.list_available () in let all_provers = Prover.list_available () in
...@@ -227,15 +223,12 @@ let verify_cmd = ...@@ -227,15 +223,12 @@ let verify_cmd =
Arg.(value & opt (some file) None & info [ "dataset-csv" ] ~doc) Arg.(value & opt (some file) None & info [ "dataset-csv" ] ~doc)
in in
Term.( Term.(
ret const
(const (fun format loadpath memlimit timelimit prover dataset_csv files _ ->
(fun format loadpath memlimit timelimit prover dataset_csv files _ -> exec_cmd cmdname (fun () ->
`Ok verify format loadpath memlimit timelimit prover dataset_csv files))
(exec_cmd cmdname (fun () -> $ format $ loadpath $ memlimit $ timelimit $ prover $ dataset_csv $ files
verify format loadpath memlimit timelimit prover dataset_csv $ setup_logs)
files)))
$ format $ loadpath $ memlimit $ timelimit $ prover $ dataset_csv
$ files $ setup_logs))
in in
Cmd.v info term Cmd.v info term
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment