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 stats = ref false let set_string_option r s = r := Some s let specs = align [ "-c", Set count, " write the number of results only"; "--count", Set count, " "; "-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]"; "--doc", String (set_string_option input_file), " "; "-o", String (set_string_option output_file), " specify the output file [default stdout]"; "--out", String (set_string_option output_file), " "; ] let usage_msg = Printf.sprintf "usage: %s [options] query" Sys.argv.(0) let usage () = usage specs usage_msg let parse () = parse specs (fun q -> query := q) usage_msg