X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Foptions.ml;h=b8c5730ab4380b9b7443c6d4d323afc7efc360b4;hp=70c2b4dbea74155285a67220f7e8800e5f77f364;hb=c6a89f390d6171f99d98f794427c1cce42fbf40c;hpb=398ce5dca1bee23f5137a3eba21df17d7aaaf1fa diff --git a/src/options.ml b/src/options.ml index 70c2b4d..b8c5730 100644 --- a/src/options.ml +++ b/src/options.ml @@ -3,26 +3,43 @@ open Arg let count = ref false let input_file : string option ref = ref None let output_file : string option ref = ref None -let query = ref "" +let queries = ref [] let stats = ref false +let compose = ref false +let parallel = ref false let set_string_option r s = r := Some s let specs = align [ - "-c", Set count, " write the number of results only"; + "-c", Set count, + " write the number of results only"; "--count", Set count, " "; - "-s", Set stats, " display timing and various statistics"; + "-s", Set stats, + " display timing and various statistics"; "--stats", Set stats, " "; - "-d", String (set_string_option input_file), " specify the input document file [default stdin]"; + "-d", String (set_string_option input_file), + " specify the input document file [default stdin]"; "--doc", String (set_string_option input_file), " "; - "-o", String (set_string_option output_file), " specify the output file [default stdout]"; + "-o", String (set_string_option output_file), + " specify the output file [default stdout]"; "--out", String (set_string_option output_file), " "; + "-C", Set compose, + " compose queries: each query is applied to the results of the \ +previous one [default run all queries from the root node]"; + "--compose", Set compose, " "; + "-p", Set parallel, + " run all queries in parallel [default run all queries \ +sequentially]"; + "--parallel", Set parallel, " "; ] -let usage_msg = Printf.sprintf "usage: %s [options] query" Sys.argv.(0) +let usage_msg = + Printf.sprintf "usage: %s [options] query [query ... query]" Sys.argv.(0) let usage () = usage specs usage_msg let parse () = - parse specs (fun q -> query := q) usage_msg - + parse specs (fun q -> queries := q :: !queries ) usage_msg; + match !queries with + [] -> raise (Arg.Bad "missing query") + | l -> queries := List.rev l