minor
[sqlgg.git] / sqlgg.ml
blob2f8922549b438a3c0bf631a09868186d6d14a933
1 (** command-line *)
3 open ListMore
4 open ExtString
5 open Operators
7 let work filename =
8 Main.with_file filename Main.parse_sql
10 let show_help () =
11 Error.log "SQL to C++ Code Generator Version %s" Config.version;
12 Error.log "";
13 Error.log " Usage: %s file_with_statements.sql" (Filename.basename Sys.executable_name);
14 Error.log "";
15 Error.log " Parse given file (treating content as SQL statements) and emit corresponding code to stdout"
17 let main () =
18 match Array.to_list Sys.argv with
19 | _::"-test"::_ -> Test.run ()
20 | _::"-version"::_ -> print_endline Config.version
21 | _::"-"::_ -> Main.parse_sql (Std.input_all stdin)
22 | _::file::_ -> work file
23 | _ -> show_help ()
25 let _ = Printexc.print main ()