OSDN Git Service

Add use_network option parser to driver
authormzp <mzpppp@gmail.com>
Sun, 20 Dec 2009 07:03:08 +0000 (16:03 +0900)
committermzp <mzpppp@gmail.com>
Sun, 20 Dec 2009 07:03:08 +0000 (16:03 +0900)
driver/cmdOpt.ml
driver/cmdOpt.mli
driver/cmdOptTest.ml

index ef47660..17f88bd 100644 (file)
@@ -14,7 +14,8 @@ type link = {
   link_cmd: string;
   size: int * int;
   bg_color: Color.t;
-  libs: string list
+  libs: string list;
+  use_network: bool;
 }
 
 type general = {
@@ -156,11 +157,17 @@ let link =
       ~short_name:'L'
       ~long_name:"libs"
       ~help:"linked library" () in
+  let use_network =
+    bool_option
+      ~default:false
+      ~long_name:"use-network"
+      ~help:"enable use_network" () in
     fun () -> {
       link_cmd = Opt.get cmd;
       bg_color = Color.parse @@ Opt.get bg_color;
       size     = (20 * Opt.get width,20 * Opt.get height); (* convert pixel to twips *)
-      libs     = Str.split (Str.regexp Config.path_sep) @@ Opt.get libs
+      libs     = Str.split (Str.regexp Config.path_sep) @@ Opt.get libs;
+      use_network = Opt.get use_network
     }
 
 let general =
index 48421b0..91b08a7 100644 (file)
@@ -8,7 +8,8 @@ type link = {
   link_cmd : string;
   size : int * int;
   bg_color : Color.t;
-  libs : string list
+  libs : string list;
+  use_network: bool
 }
 
 type general = {
index ec3bde9..1b5e74a 100644 (file)
@@ -67,5 +67,9 @@ let _ = begin "cmdOpt.ml" >::: [
   "link std" >:: begin fun () ->
     ok true (fun t -> t.scm.link_std) "";
     ok false (fun t -> t.scm.link_std) "--no_std";
+  end;
+  "use network" >:: begin fun () ->
+    ok false (fun t -> t.link.use_network) "";
+    ok true (fun t -> t.link.use_network) "--use-network";
   end
 ] end +> run_test_tt_main