summaryrefslogtreecommitdiff
path: root/2025/ocaml/lib
diff options
context:
space:
mode:
Diffstat (limited to '2025/ocaml/lib')
-rw-r--r--2025/ocaml/lib/application/day_1.ml1
-rw-r--r--2025/ocaml/lib/application/dune3
-rw-r--r--2025/ocaml/lib/application/logger_sig.mli11
-rw-r--r--2025/ocaml/lib/domain/day_1.ml0
-rw-r--r--2025/ocaml/lib/infrastructure/dune6
-rw-r--r--2025/ocaml/lib/infrastructure/logger.ml31
-rw-r--r--2025/ocaml/lib/presentation/cli.ml26
7 files changed, 17 insertions, 61 deletions
diff --git a/2025/ocaml/lib/application/day_1.ml b/2025/ocaml/lib/application/day_1.ml
new file mode 100644
index 0000000..7ddac8b
--- /dev/null
+++ b/2025/ocaml/lib/application/day_1.ml
@@ -0,0 +1 @@
+let run () = failwith "day 1 not implemented"
diff --git a/2025/ocaml/lib/application/dune b/2025/ocaml/lib/application/dune
index e4803c5..b78613a 100644
--- a/2025/ocaml/lib/application/dune
+++ b/2025/ocaml/lib/application/dune
@@ -11,5 +11,4 @@
ppx_deriving.eq
ppx_deriving.ord
ppx_inline_test
- ppx_expect))
- (modules_without_implementation logger_sig))
+ ppx_expect)))
diff --git a/2025/ocaml/lib/application/logger_sig.mli b/2025/ocaml/lib/application/logger_sig.mli
deleted file mode 100644
index ac84747..0000000
--- a/2025/ocaml/lib/application/logger_sig.mli
+++ /dev/null
@@ -1,11 +0,0 @@
-module type Logger = sig
- val app : string -> unit
-
- val err : string -> unit
-
- val warn : string -> unit
-
- val info : string -> unit
-
- val debug : string -> unit
-end
diff --git a/2025/ocaml/lib/domain/day_1.ml b/2025/ocaml/lib/domain/day_1.ml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/2025/ocaml/lib/domain/day_1.ml
diff --git a/2025/ocaml/lib/infrastructure/dune b/2025/ocaml/lib/infrastructure/dune
index b2c72e0..b9d250f 100644
--- a/2025/ocaml/lib/infrastructure/dune
+++ b/2025/ocaml/lib/infrastructure/dune
@@ -4,11 +4,7 @@
application
domain
fmt
- fmt.cli
- fmt.tty
- logs
- logs.cli
- logs.fmt)
+ logs)
(inline_tests)
(preprocess
(pps
diff --git a/2025/ocaml/lib/infrastructure/logger.ml b/2025/ocaml/lib/infrastructure/logger.ml
deleted file mode 100644
index d0d37a3..0000000
--- a/2025/ocaml/lib/infrastructure/logger.ml
+++ /dev/null
@@ -1,31 +0,0 @@
-module type Configurable_Logger = sig
- include Application.Logger_sig.Logger
-
- val configure_logger : level:Logs.level option -> unit
-
- val parse_level :
- env:Cmdliner.Cmd.Env.info -> Logs.level option Cmdliner.Term.t
-
- val configure_renderer : style_renderer:Fmt.style_renderer option -> unit
-end
-
-module CLI_Logger : Configurable_Logger = struct
- let configure_logger ~level =
- Logs.set_level level ;
- Logs.set_reporter (Logs_fmt.reporter ())
-
- let parse_level ~env = Logs_cli.level ~env ()
-
- let configure_renderer ~style_renderer =
- Fmt_tty.setup_std_outputs ?style_renderer ()
-
- let app msg = Logs.app (fun m -> m "%s" msg)
-
- let err msg = Logs.err (fun m -> m "%s" msg)
-
- let warn msg = Logs.warn (fun m -> m "%s" msg)
-
- let info msg = Logs.info (fun m -> m "%s" msg)
-
- let debug msg = Logs.debug (fun m -> m "%s" msg)
-end
diff --git a/2025/ocaml/lib/presentation/cli.ml b/2025/ocaml/lib/presentation/cli.ml
index c306ad2..26ec365 100644
--- a/2025/ocaml/lib/presentation/cli.ml
+++ b/2025/ocaml/lib/presentation/cli.ml
@@ -1,15 +1,17 @@
-open Cmdliner
-open Cmdliner.Term.Syntax
+let run_day = function
+ | 1 ->
+ Application.Day_1.run ()
+ | _ ->
+ failwith "day not implemented"
-let logger () =
- let env = Cmd.Env.info "LOG_LEVEL" in
- let+ level = Infrastructure.Logger.CLI_Logger.parse_level ~env
- and+ style_renderer = Fmt_cli.style_renderer () in
- Infrastructure.Logger.CLI_Logger.configure_logger ~level ;
- Fmt_tty.setup_std_outputs ?style_renderer () ;
- let result_code = 0 in
- result_code
+let day_arg =
+ let doc = "Day to run (1-12)." in
+ Cmdliner.Arg.(value & pos 0 int 1 & info [] ~docv:"DAY" ~doc)
-let cmd = Cmd.v (Cmd.info "tool") @@ logger ()
+let day_t = Cmdliner.Term.(const run_day $ day_arg)
-let run () = Cmd.eval' cmd
+let cmd =
+ let info = Cmdliner.Cmd.info "aoc" ~version:"%%VERSION%%" in
+ Cmdliner.Cmd.v info day_t
+
+let run () = Cmdliner.Cmd.eval' cmd