From 94357f8fef1e4800197118b70587dc5121e3fb5a Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Fri, 19 Jan 2024 11:43:44 +0100 Subject: [PATCH] Upgrade Eio_writer to 0.0.3 --- CHANGES.md | 6 ++++++ auto-format.opam | 2 +- dune-project | 2 +- src/auto_format.ml | 22 +++++++++++----------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1643f10..831f649 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +## Unreleased + +### Changed + +- Upgrade to `Eio_writer.0.0.3` API (breaking change). + ## 0.0.2 (2024-01-17) ### Changed diff --git a/auto-format.opam b/auto-format.opam index d09e1db..23f8d9f 100644 --- a/auto-format.opam +++ b/auto-format.opam @@ -12,7 +12,7 @@ depends: [ "ocaml" {>= "5.1"} "base" {>= "v0.16" & < "v0.17"} "eio" {>= "0.13"} - "eio-writer" {>= "0.0.1"} + "eio-writer" {>= "0.0.3"} "eio_main" {>= "0.13"} "expect_test_helpers_core" {with-test & >= "v0.16" & < "v0.17"} "fpath" {>= "0.7.3"} diff --git a/dune-project b/dune-project index 9827364..064c838 100644 --- a/dune-project +++ b/dune-project @@ -28,7 +28,7 @@ (eio (>= 0.13)) (eio-writer - (>= 0.0.1)) + (>= 0.0.3)) (eio_main (>= 0.13)) (expect_test_helpers_core diff --git a/src/auto_format.ml b/src/auto_format.ml index 6e45c27..4ae1bf7 100644 --- a/src/auto_format.ml +++ b/src/auto_format.ml @@ -122,15 +122,15 @@ struct @@ fun stdout -> List.iter files ~f:(fun filename -> let path = Eio.Path.(cwd / filename) in - Eio_writer.printf stdout "================================: %s\n" filename; + Eio_writer.writef stdout "================================: %s\n" filename; match pretty_print ~env ~path ~read_contents_from_stdin:false with - | Error e -> Eio_writer.print_endline stdout (Error.to_string_hum e) + | Error e -> Eio_writer.write_line stdout (Error.to_string_hum e) | Ok { pretty_printed_contents; result } -> - Eio_writer.print_string stdout pretty_printed_contents; + Eio_writer.write_string stdout pretty_printed_contents; (match result with | Ok () -> () | Error e -> - Eio_writer.printf stdout "======: errors\n%s\n" (Error.to_string_hum e)))) + Eio_writer.writef stdout "======: errors\n%s\n" (Error.to_string_hum e)))) ;; let gen_dune_cmd = @@ -193,7 +193,7 @@ struct in Eio_writer.with_flow (Eio.Stdenv.stdout env) @@ fun stdout -> - Eio_writer.printf + Eio_writer.writef stdout "; dune file generated by '%s' -- do not edit.\n" (List.map call ~f:(function @@ -202,7 +202,7 @@ struct |> String.concat ~sep:" "); List.iter files ~f:(fun file -> List.iter (generate_rules ~file) ~f:(fun sexp -> - Eio_writer.print_s stdout sexp))) + Eio_writer.write_sexp stdout sexp))) ;; let file_cmd = @@ -264,14 +264,14 @@ into this issue. pretty_print ~env ~path ~read_contents_from_stdin in Eio_writer.with_flow (Eio.Stdenv.stdout env) (fun stdout -> - Eio_writer.print_string stdout pretty_printed_contents; - if add_extra_blank_line then Eio_writer.print_newline stdout); + Eio_writer.write_string stdout pretty_printed_contents; + if add_extra_blank_line then Eio_writer.write_newline stdout); result with | Ok () -> () | Error e -> Eio_writer.with_flow (Eio.Stdenv.stderr env) (fun stderr -> - Eio_writer.print_endline stderr (Error.to_string_hum e)); + Eio_writer.write_line stderr (Error.to_string_hum e)); Stdlib.exit 1) ;; @@ -299,13 +299,13 @@ into this issue. in Ref.set_temporarily Loc.include_sexp_of_positions with_positions ~f:(fun () -> Eio_writer.with_flow (Eio.Stdenv.stdout env) (fun stdout -> - Eio_writer.print_s stdout [%sexp (program : T.t)])); + Eio_writer.write_sexp stdout [%sexp (program : T.t)])); return () with | Ok () -> () | Error e -> Eio_writer.with_flow (Eio.Stdenv.stderr env) (fun stderr -> - Eio_writer.print_endline stderr (Error.to_string_hum e)); + Eio_writer.write_line stderr (Error.to_string_hum e)); Stdlib.exit 1) ;;