Skip to content

Commit

Permalink
Prepare for climate.0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Oct 12, 2024
1 parent 06d8053 commit 826c4ea
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 287 deletions.
2 changes: 1 addition & 1 deletion cmdlang-tests.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ depends: [
"ocamlformat" {with-dev-setup & = "0.26.2"}
"base" {>= "v0.17" & < "v0.18"}
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"climate" {= "0.0.1~preview-0.1"}
"climate" {>= "0.1.0~preview-0.1"}
"cmdlang" {= version}
"cmdlang-cmdliner-runner" {= version}
"cmdlang-to-base" {= version}
Expand Down
2 changes: 1 addition & 1 deletion cmdlang-to-climate.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"}
"climate" {= "0.0.1~preview-0.1"}
"climate" {>= "0.1.0~preview-0.1"}
"cmdlang" {= version}
"odoc" {with-doc}
]
Expand Down
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
(ocaml
(>= 5.2))
(climate
(= 0.0.1~preview-0.1))
(>= 0.1.0~preview-0.1))
(cmdlang
(= :version))))

Expand Down Expand Up @@ -172,7 +172,7 @@
:with-dev-setup
(>= 2.8.3)))
(climate
(= 0.0.1~preview-0.1))
(>= 0.1.0~preview-0.1))
(cmdlang
(= :version))
(cmdlang-cmdliner-runner
Expand Down
16 changes: 10 additions & 6 deletions test/expect/arg_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ let eval_climate t { Command_line.prog; args } =
| Ok arg_parser ->
(match
let cmd = Climate.Command.singleton arg_parser in
Climate.Command.eval cmd { program = prog; args }
Climate.Command.eval cmd ~program_name:(Literal prog) args
with
| () -> ()
| exception e -> print_s [%sexp "Evaluation Raised", (e : Exn.t)] [@coverage off])
Expand All @@ -101,10 +101,14 @@ let eval_cmdliner t { Command_line.prog; args } =
let eval_all t command_line =
List.iter Backend.all ~f:(fun backend ->
print_endline
(Printf.sprintf "----------------------------- %s" (Backend.to_string backend));
match backend with
| Climate -> eval_climate t command_line
| Cmdliner -> eval_cmdliner t command_line
| Core_command -> eval_base t command_line);
(Printf.sprintf
"----------------------------------------------------- %s"
(Backend.to_string backend));
(match backend with
| Climate -> eval_climate t command_line
| Cmdliner -> eval_cmdliner t command_line
| Core_command -> eval_base t command_line);
Stdlib.(flush stdout);
Stdlib.(flush stderr));
()
;;
36 changes: 18 additions & 18 deletions test/expect/test__applicative_operations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ let%expect_test "const" =
Arg_test.eval_all test { prog = "test"; args = [] };
[%expect
{|
----------------------------- Climate
----------------------------------------------------- Climate
hello
----------------------------- Cmdliner
----------------------------------------------------- Cmdliner
hello
----------------------------- Core_command
----------------------------------------------------- Core_command
hello
|}];
()
Expand All @@ -30,31 +30,31 @@ let%expect_test "map" =
Arg_test.eval_all test { prog = "test"; args = [ "0" ] };
[%expect
{|
----------------------------- Climate
----------------------------------------------------- Climate
(0)
----------------------------- Cmdliner
----------------------------------------------------- Cmdliner
(0)
----------------------------- Core_command
----------------------------------------------------- Core_command
(0)
|}];
Arg_test.eval_all test { prog = "test"; args = [ "not-an-int" ] };
[%expect
{|
----------------------------- Climate
----------------------------------------------------- Climate
()
----------------------------- Cmdliner
----------------------------------------------------- Cmdliner
()
----------------------------- Core_command
----------------------------------------------------- Core_command
()
|}];
Arg_test.eval_all test { prog = "test"; args = [ "42" ] };
[%expect
{|
----------------------------- Climate
----------------------------------------------------- Climate
(42)
----------------------------- Cmdliner
----------------------------------------------------- Cmdliner
(42)
----------------------------- Core_command
----------------------------------------------------- Core_command
(42)
|}];
()
Expand Down Expand Up @@ -91,21 +91,21 @@ let%expect_test "apply" =
Arg_test.eval_all test { prog = "test"; args = [ "succ"; "0" ] };
[%expect
{|
----------------------------- Climate
----------------------------------------------------- Climate
1
----------------------------- Cmdliner
----------------------------------------------------- Cmdliner
1
----------------------------- Core_command
----------------------------------------------------- Core_command
1
|}];
Arg_test.eval_all test { prog = "test"; args = [ "pred"; "42" ] };
[%expect
{|
----------------------------- Climate
----------------------------------------------------- Climate
41
----------------------------- Cmdliner
----------------------------------------------------- Cmdliner
41
----------------------------- Core_command
----------------------------------------------------- Core_command
41
|}];
()
Expand Down
3 changes: 2 additions & 1 deletion test/expect/test__cmd_name_with_underscore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ let%expect_test "climate" =
(* In climate, subcommand names containing an underscore are valid. *)
Climate.Command.eval
(Cmdlang_to_climate.Translate.command group)
{ program = "./main.exe"; args = [ "name_with_underscore" ] };
~program_name:(Literal "./main.exe")
[ "name_with_underscore" ];
[%expect {||}];
()
;;
Expand Down
Loading

0 comments on commit 826c4ea

Please sign in to comment.