diff options
Diffstat (limited to '2025/ocaml/lib/presentation/cli.ml')
| -rw-r--r-- | 2025/ocaml/lib/presentation/cli.ml | 26 |
1 files changed, 14 insertions, 12 deletions
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 |
