This commit is contained in:
swrup 2025-10-13 09:40:39 +02:00
parent 636d351a09
commit 7099a78667

View file

@ -120,6 +120,7 @@ let parse s =
| Error msg -> Fmt.failwith "config parse error: %s" msg | Error msg -> Fmt.failwith "config parse error: %s" msg
| Ok v -> fold_sections v | Ok v -> fold_sections v
module Pp_debug = struct
let pp_item ppf { key; value } = let pp_item ppf { key; value } =
let open Fmt in let open Fmt in
match String.contains value '"' || String.contains value ' ' with match String.contains value '"' || String.contains value ' ' with
@ -145,12 +146,13 @@ let pp_section ppf { header; items } =
let pp_config ppf l = let pp_config ppf l =
let open Fmt in let open Fmt in
pf ppf "%a" (list ~sep:(any "\n") pp_section) l pf ppf "%a" (list ~sep:(any "\n") pp_section) l
end
let () = let () =
let content = read_file "default.config" in let content = read_file "default.config" in
(*Fmt.pr "%s" content;*) (*Fmt.pr "%s" content;*)
let config = parse content in let config = parse content in
(*Fmt.pr "%a@." pp_lines config;*) (*Fmt.pr "%a@." pp_lines config;*)
Fmt.pr "%a@." pp_config config; Fmt.pr "%a@." Pp_debug.pp_config config;
() ()