Skip to content

Commit

Permalink
Upgrade Eio_writer to 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Jan 19, 2024
1 parent de3f2fa commit 94357f8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Changed

- Upgrade to `Eio_writer.0.0.3` API (breaking change).

## 0.0.2 (2024-01-17)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion auto-format.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(eio
(>= 0.13))
(eio-writer
(>= 0.0.1))
(>= 0.0.3))
(eio_main
(>= 0.13))
(expect_test_helpers_core
Expand Down
22 changes: 11 additions & 11 deletions src/auto_format.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand All @@ -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 =
Expand Down Expand Up @@ -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)
;;

Expand Down Expand Up @@ -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)
;;

Expand Down

0 comments on commit 94357f8

Please sign in to comment.