|
@@ -114,7 +114,7 @@ let create_basic name =
|
|
|
|> Messages.warning;
|
|
|
Messages.tips welcome_msg;
|
|
|
Licencing.print ~cecill:false;
|
|
|
- Out_channel.write_all name basic_template
|
|
|
+ Out_channel.write_all name ~data:basic_template
|
|
|
;;
|
|
|
|
|
|
let rec get_basic rc_name =
|
|
@@ -132,7 +132,7 @@ let rec get_basic rc_name =
|
|
|
;;
|
|
|
|
|
|
(* From objects to types *)
|
|
|
-let tag_of_object tag = failwith "Not implemented";;
|
|
|
+let tag_of_object tag = failwith "Not implemented";;
|
|
|
let setting_of_object setting = failwith "Not implemented";;
|
|
|
let entry_of_object entry =
|
|
|
{
|
|
@@ -194,6 +194,7 @@ type t = <
|
|
|
filter_map_entries : f:(int -> entry -> entry option) -> t;
|
|
|
filter_map_settings : f:(setting -> setting option) -> t;
|
|
|
get_name : string;
|
|
|
+ to_string : string;
|
|
|
map_common_tags : f:(tag -> tag) -> t;
|
|
|
map_entries : f:(int -> entry -> entry) -> t;
|
|
|
map_settings : f:(setting -> setting) -> t;
|
|
@@ -268,6 +269,9 @@ let init ?(rc=(!Const.rc_file)) () =
|
|
|
method remove_entry n =
|
|
|
self#filter_map_entries ~f:(fun i e -> if i=n then None else Some e)
|
|
|
|
|
|
+ (* Get a string representing rc file, on debugging purpose *)
|
|
|
+ method to_string = failwith "Not implemented"
|
|
|
+
|
|
|
(* Name of rc file when written to disk *)
|
|
|
val name = Lazy.force rc
|
|
|
method get_name = name
|
|
@@ -283,7 +287,7 @@ let init ?(rc=(!Const.rc_file)) () =
|
|
|
in
|
|
|
let data = String.concat [ rc_header ; "\n\n\n" ; body ; "\n" ] in
|
|
|
Out_channel.write_all name ~data
|
|
|
- (** Write rc file at instantiation. Entries should be changed in group, to
|
|
|
+ (* Write rc file at instantiation. Entries should be changed in group, to
|
|
|
* avoid multiple writing. Although, there is some cache done by out_channels,
|
|
|
* this is not very dangerous *)
|
|
|
initializer self#write
|
|
@@ -307,7 +311,7 @@ let empty_entry () =
|
|
|
let import ~from ~to_file =
|
|
|
let imported_rc : t = init ~rc:to_file () in
|
|
|
let to_import : File_com.t = File_com.init_rc ~rc:from () in
|
|
|
- to_import.progs |> List.map ~f:(new entry)
|
|
|
+ to_import.progs |> List.map ~f:(fun command -> new entry command)
|
|
|
|> imported_rc#change_entries
|
|
|
|> fun rc -> rc#write;
|
|
|
Messages.ok "Import successful!";
|