@@ -9,7 +9,8 @@ let docroot = ref "run"
99let index = ref " index.html"
1010let addr = ref " 127.0.0.1"
1111let port = ref 8080
12- let goblint = ref " goblint"
12+ let goblint = ref " ./goblint"
13+ let file_paths = ref []
1314let rest = ref []
1415
1516let specs =
@@ -22,8 +23,6 @@ let specs =
2223 (" -goblint" , Arg. Rest_all (fun args -> rest := args), " Pass the rest of the arguments to Goblint" );
2324 ]
2425
25- let paths = ref []
26-
2726let process state name body =
2827 match Hashtbl. find_option Api. registry name with
2928 | None -> Server. respond_not_found ()
@@ -146,7 +145,7 @@ let callback state _ req body =
146145 | _ -> Server. respond_not_found ()
147146
148147let main () =
149- let % lwt state = Goblint. spawn ! goblint (! rest @ ! paths ) > |= State. make in
148+ let % lwt state = Goblint. spawn ! goblint (! rest @ ! file_paths ) > |= State. make in
150149 (* run Goblint once with option gobview enabled to copy the index.html and main.js files into the served directory *)
151150 let % lwt _ = Goblint. analyze ~save_dir: ! docroot ~gobview: true state.goblint in
152151 let callback = callback state in
@@ -155,6 +154,7 @@ let main () =
155154
156155let () =
157156 let program = Sys. argv.(0 ) in
158- let usage = Printf. sprintf " %s [-docroot DOCROOT] [-index INDEX] [-addr ADDR] [-port PORT] ... path [path ...]" program in
159- Arg. parse specs (fun s -> paths := s :: ! paths) usage;
157+ let usage = Printf. sprintf " Usage: %s [options] source-files\n Lookup options using '%s --help'." program program in
158+ let anon_arg a = file_paths := a :: ! file_paths; () in
159+ Arg. parse specs anon_arg usage;
160160 Lwt_main. run (main () )
0 commit comments