Skip to content
Browse files

[feature] dbGen: Command line to swicth backend

  • Loading branch information...
1 parent 13f7390 commit 127d16d5e5480d8b1818382b137c6c45156c1a02 @BourgerieQuentin BourgerieQuentin committed
Showing with 48 additions and 3 deletions.
  1. +29 −1 libqmlcompil/qmlDbGen.ml
  2. +17 −1 libqmlcompil/qmlDbGen.mli
  3. +1 −1 opalib/_tags
  4. +1 −0 opalib/opaEnv.ml
View
30 libqmlcompil/qmlDbGen.ml
@@ -19,8 +19,36 @@
@author Louis Gesbert
**)
-(* Exported module with reduced interface *)
+module Arg = Base.Arg
+type engine = Db3 | Mongo
+
+module Args = struct
+
+ type options = {
+ engine : engine
+ }
+
+ let default = {
+ engine = Db3
+ }
+
+ let descr = function
+ | Db3 -> "Db3"
+ | Mongo -> "Mongo"
+
+ let assoc = [("mongo", Mongo); ("db3"), Db3]
+
+ let r = ref default
+
+ let options = [
+ ("--database", Arg.spec_fun_of_assoc (fun s -> r := {engine=s}) assoc,
+ "Select kind of database (db3|mongo)");
+ ]
+
+ let get_engine() = !r.engine
+
+end
let settyp = DbGen_common.settyp
View
18 libqmlcompil/qmlDbGen.mli
@@ -15,7 +15,23 @@
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
-(* Exported module: reduced interface *)
+
+(** {6} Command line arguments.*)
+
+(** Describes different backend that dbgen handle. *)
+type engine = Db3 | Mongo
+
+(** Command line specification provides necessary options for switch
+ database backend. *)
+module Args : sig
+
+ (** The command line specifications. *)
+ val options : (string * Base.Arg.spec * string) list
+
+ (** Get selected backend.*)
+ val get_engine : unit -> engine
+
+end
(** {6} Initialization **)
View
2 opalib/_tags
@@ -4,7 +4,7 @@
<**/*.{ml,mli}>: use_libbase
# specific tags, compilation
-<opaEnv.ml> : use_qml2ocaml, use_passlib, use_compilerlib, use_qmlflatcompiler, use_qmlpasses, use_qml2js, use_qmljsimp, use_opalang
+<opaEnv.ml> : use_qml2ocaml, use_passlib, use_compilerlib, use_qmlflatcompiler, use_qmlpasses, use_qml2js, use_qmljsimp, use_opalang, use_libqmlcompil
<opaWalker.ml>: thread
<opa_Common.{ml,mli}>: use_libqmlcompil, use_opalang
View
1 opalib/opaEnv.ml
@@ -442,6 +442,7 @@ struct
ObjectFiles.Arg.public_options @
I18n.options @
OpaSyntax.Args.options @
+ QmlDbGen.Args.options @
[
(* a *)
"--api",

0 comments on commit 127d16d

Please sign in to comment.
Something went wrong with that request. Please try again.