summaryrefslogtreecommitdiff
path: root/test/configuration_.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-03-27 08:48:05 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-03-27 08:48:05 +0100
commit830e7c5d27d161b91402414e6ecd49f1ed818bfb (patch)
tree448864635d29b1ea66424cbb9e0816fbcf1e1907 /test/configuration_.ml
Initial commit
Diffstat (limited to 'test/configuration_.ml')
-rw-r--r--test/configuration_.ml27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/configuration_.ml b/test/configuration_.ml
new file mode 100644
index 0000000..0fd42fb
--- /dev/null
+++ b/test/configuration_.ml
@@ -0,0 +1,27 @@
+let name = "configuration"
+let description = "Load the configuration file and report errors"
+let printer = ref (fun formatter _ -> Format.pp_print_nothing formatter ())
+
+let speclist =
+ [
+ ( "-tree",
+ Arg.Unit
+ (fun () ->
+ printer :=
+ fun formater conf ->
+ Configuration.Graph_tree.pp formater (Configuration.Ast.tree conf)),
+ "Print the depenncy tree between root contents" );
+ ]
+
+type t = (Configuration.Ast.setting, Configuration.Read_conf.error) result
+
+let pp : Format.formatter -> t -> unit =
+ Format.pp_print_result ~error:Configuration.Read_conf.pp_error
+ ~ok:(fun formater conf -> !printer formater conf)
+
+let exec : string list -> t =
+ fun _ ->
+ let stdin = In_channel.input_all stdin in
+ let ( let+ ) opt cont = Result.map cont opt in
+ let+ configuration = Configuration.Read_conf.read_string_conf stdin in
+ configuration