Skip to content

Commit

Permalink
Upgrade ocamlformat to 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Dec 3, 2024
1 parent e238e8f commit aa88b24
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=0.26.2
version=0.27.0
profile=janestreet
2 changes: 1 addition & 1 deletion cmdlang-tests.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bug-reports: "https://github.com/mbarbin/cmdlang/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
"ocamlformat" {with-dev-setup & = "0.26.2"}
"ocamlformat" {with-dev-setup & = "0.27.0"}
"base" {>= "v0.17" & < "v0.18"}
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"climate" {>= "0.3.0"}
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
(ocamlformat
(and
:with-dev-setup
(= 0.26.2)))
(= 0.27.0)))
(base
(and
(>= v0.17)
Expand Down
26 changes: 13 additions & 13 deletions lib/cmdlang_stdlib_runner/src/cmdlang_stdlib_runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module Parser_state = Parser_state
module Positional_state = Positional_state

let usage_msg
~argv
~resume_parsing_from_index
~summary
~readme
~subcommands
~positional_state
~argv
~resume_parsing_from_index
~summary
~readme
~subcommands
~positional_state
=
let usage_prefix =
Array.sub argv 0 resume_parsing_from_index |> Array.to_list |> String.concat " "
Expand Down Expand Up @@ -60,13 +60,13 @@ let usage_msg
;;

let eval_arg
(type a)
~(arg : a Ast.Arg.t)
~summary
~readme
~subcommands
~argv
~resume_parsing_from_index
(type a)
~(arg : a Ast.Arg.t)
~summary
~readme
~subcommands
~argv
~resume_parsing_from_index
=
let state =
match Parser_state.create arg with
Expand Down
3 changes: 2 additions & 1 deletion lib/cmdlang_stdlib_runner/test/test__stdlib_runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ let%expect_test "eval_exit_code" =
print_endline (Printf.sprintf "[%d]" code)
in
test [];
[%expect {|
[%expect
{|
false
[0]
|}];
Expand Down
4 changes: 2 additions & 2 deletions lib/cmdlang_to_base/src/translate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module Arg = struct
Error.raise_s
[%sexp
"Positional arguments must be supplied in consecutive order"
, { expected : int; got = (next_positional_index : int) }]
, { expected : int; got = (next_positional_index : int) }]
;;

let translate : type a. a Ast.Arg.t -> config:Config.t -> a t =
Expand Down Expand Up @@ -110,7 +110,7 @@ module Arg = struct
raise_s
[%sexp
"Flag_count not supported by core.command"
, { names = (hd :: tl : string list); doc : string }]
, { names = (hd :: tl : string list); doc : string }]
| Named { names; param; docv; doc } ->
let (name :: aliases) = translate_flag_names names ~config in
let arg_type = Param.translate param ~config in
Expand Down
6 changes: 4 additions & 2 deletions lib/cmdlang_to_climate/test/test__param.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ let%expect_test "enumerated" =
Cmdlang_to_climate.Translate.param (Command.Param.enumerated (module Color))
in
List.iter Color.all ~f:(fun color -> Stdlib.Format.printf "%a\n" conv.print color);
[%expect {|
[%expect
{|
red
green
blue
Expand All @@ -56,7 +57,8 @@ let%expect_test "enumerated" =
in
List.iter Missing_color.all ~f:(fun color ->
Stdlib.Format.printf "%a\n" conv.print color);
[%expect {|
[%expect
{|
red
green
|}];
Expand Down
2 changes: 1 addition & 1 deletion lib/cmdlang_to_cmdliner/test/test__param.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let%expect_test "param" =
print_s
[%sexp
(str : string)
, (Cmdliner.Arg.conv_parser conv str : (a, [ `Msg of string ]) Result.t)])
, (Cmdliner.Arg.conv_parser conv str : (a, [ `Msg of string ]) Result.t)])
in
conv Command.Param.int [%sexp_of: int] [ ""; "a"; "0"; "42"; "-17" ];
[%expect
Expand Down
5 changes: 3 additions & 2 deletions test/cram/src/cmd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ module Doc = struct
let singleton_with_readme =
Command.make
~summary:"Singleton command with a readme"
~readme:(fun () -> {|
~readme:(fun () ->
{|
This is a readme.
It can be written on multiple lines.
|})
Expand Down Expand Up @@ -327,7 +328,7 @@ module Named = struct
else
Error
(`Msg
(Printf.sprintf "%S: invalid 4 letters alphanumerical identifier" t))
(Printf.sprintf "%S: invalid 4 letters alphanumerical identifier" t))
;;

let default =
Expand Down
8 changes: 4 additions & 4 deletions test/expect/arg_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ let () =
[%extension_constructor Climate.Parse_error.E]
(function
| Climate.Parse_error.E e ->
List [ Atom "Climate.Parse_error.E"; Atom (Climate.Parse_error.to_string e) ] [@coverage
off]
List [ Atom "Climate.Parse_error.E"; Atom (Climate.Parse_error.to_string e) ]
[@coverage off]
| _ -> assert false);
Sexplib0.Sexp_conv.Exn_converter.add
[%extension_constructor Climate.Spec_error.E]
(function
| Climate.Spec_error.E e ->
List [ Atom "Climate.Spec_error.E"; Atom (Climate.Spec_error.to_string e) ] [@coverage
off]
List [ Atom "Climate.Spec_error.E"; Atom (Climate.Spec_error.to_string e) ]
[@coverage off]
| _ -> assert false);
()
;;
Expand Down
9 changes: 6 additions & 3 deletions test/expect/test__invalid_pos_opt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ let%expect_test "cmdliner" =
|> Stdlib.print_int
in
run [ "A"; "B" ];
[%expect {|
[%expect
{|
((a (A)) (b B))
0
|}];
Expand All @@ -107,12 +108,14 @@ let%expect_test "stdlib-runner" =
|> Stdlib.print_int
in
run [ "A"; "B" ];
[%expect {|
[%expect
{|
((a (A)) (b B))
0
|}];
run [ "B" ];
[%expect {|
[%expect
{|
Missing required positional argument at position 1.
2
|}];
Expand Down

0 comments on commit aa88b24

Please sign in to comment.