]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/matitaclean.ml
now tables are recreated if needed and mattiaclean all really clears the owner env...
[helm.git] / helm / matita / matitaclean.ml
1 module UM = UriManager;;
2 module TA = TacticAst;;
3
4 let _ =
5   Helm_registry.load_from "matita.conf.xml";
6   Http_getter.init ();
7   MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner")
8
9 let main uri_to_remove = MatitacleanLib.clean_baseuris uri_to_remove
10
11 let usage () =
12   prerr_endline "";
13   prerr_endline "usage:";
14   prerr_endline "\tmatitaclean all";
15   prerr_endline "\t\tcleans the whole environment";
16   prerr_endline "\tmatitaclean files...";
17   prerr_endline "\t\tcleans the output of the compilation of files...\n";
18   prerr_endline "";
19   exit 1
20     
21 let _ = 
22   if Array.length Sys.argv < 2 then usage ();
23   if Sys.argv.(1) = "all" then 
24     begin
25       MatitaDb.clean_owner_environment ();
26       exit 0
27     end
28   let uri_to_remove =ref [] in
29   (try 
30     for i = 1 to Array.length Sys.argv - 1 do
31       let suri = Sys.argv.(i) in
32       let uri = 
33         try
34           UM.buri_of_uri (UM.uri_of_string suri)
35         with
36           UM.IllFormedUri _ -> MatitacleanLib.baseuri_of_file suri
37       in
38       uri_to_remove := uri :: !uri_to_remove
39     done
40   with
41     Invalid_argument _ -> usage ());
42   main !uri_to_remove
43