-let main () =
- let _ = MatitaInit.initialize_all () in
- if not (Helm_registry.get_bool "matita.verbose") then MatitaMisc.shutup ();
- let files =
- match Helm_registry.get_list Helm_registry.string "matita.args" with
- | [ "all" ] -> clean_all (); exit 0
- | [] ->
- (match Librarian.find_roots_in_dir (Sys.getcwd ()) with
- | [x] ->
- Sys.chdir (Filename.dirname x);
- HExtlib.find ~test:(fun x -> Filename.check_suffix x ".ma") "."
- | [] ->
- prerr_endline "No targets and no root found"; exit 1
- | roots ->
- let roots = List.map (HExtlib.chop_prefix (Sys.getcwd()^"/")) roots in
- prerr_endline ("Too many roots found:\n\t" ^ String.concat "\n\t" roots);
- prerr_endline ("\nEnter one of these directories and retry");
- exit 1);
- | files -> files
- in
- let uris_to_remove =
- List.fold_left
- (fun uris_to_remove suri ->
+let get_all_scripts () =
+ match L.find_roots_in_dir (Sys.getcwd ()) with
+ | [root] ->
+ let bdir = Filename.dirname root in
+ HExtlib.find ~test:(fun x -> Filename.check_suffix x ".ma") bdir
+ | [] ->
+ prerr_endline "no roots found"; exit 1
+ | roots ->
+ let roots = List.map (HExtlib.chop_prefix (Sys.getcwd()^"/")) roots in
+ prerr_endline ("Too many roots found:\n\t" ^ String.concat "\n\t" roots);
+ prerr_endline ("\nEnter one of these directories and retry");
+ exit 1
+
+let remove_all_items items =
+ let map item =
+ if L.is_uri item then item else
+ let _,buri,_,_ = L.baseuri_of_script ~include_paths:[] item in
+ buri
+ in
+(*MATITA 1.0, CSC: verify that uris_to_remove are reasonable uris *)
+ let uris_to_remove = List.map map items in
+ LibraryClean.clean_baseuris ~verbose:true uris_to_remove
+
+(* FG: Old code kept for reference
+