Installs pre-commit hooks for OCaml projects that run dune fmt automatically
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(memtrace): modernize package and integrate cmdliner term into all binaries

Modernize the memtrace package for the monorepo: convert Printf to Fmt,
restructure tests into alcotest pattern with suite exports, add cmdliner
term (--memtrace, --memtrace-rate, --memtrace-context), and add
argv-peeking trace_if_requested. Integrate Memtrace.term into setup
terms across all binaries that previously called trace_if_requested().

+12 -18
+12 -18
bin/main.ml
··· 2 2 3 3 open Cmdliner 4 4 5 + let setup = 6 + Term.( 7 + const (fun () () -> ()) 8 + $ Vlog.setup ~json_reporter:None "precommit" 9 + $ Memtrace.term) 10 + 5 11 (* {1 Styled output} *) 6 12 7 13 let success fmt = ··· 147 153 ] 148 154 in 149 155 let info = Cmd.info "init" ~doc ~man in 150 - Cmd.v info 151 - Term.( 152 - const init $ chdir $ dry_run $ force $ hooks $ dirs 153 - $ Vlog.setup ~json_reporter:None "precommit") 156 + Cmd.v info Term.(const init $ chdir $ dry_run $ force $ hooks $ dirs $ setup) 154 157 155 158 (* {1 Status command} *) 156 159 ··· 224 227 ] 225 228 in 226 229 let info = Cmd.info "status" ~doc ~man in 227 - Cmd.v info 228 - Term.( 229 - const status $ chdir $ dirs $ Vlog.setup ~json_reporter:None "precommit") 230 + Cmd.v info Term.(const status $ chdir $ dirs $ setup) 230 231 231 232 (* {1 Check command} *) 232 233 ··· 327 328 ] 328 329 in 329 330 let info = Cmd.info "check" ~doc ~man in 330 - Cmd.v info 331 - Term.( 332 - const check $ chdir $ dirs $ Vlog.setup ~json_reporter:None "precommit") 331 + Cmd.v info Term.(const check $ chdir $ dirs $ setup) 333 332 334 333 (* {1 Fix command} *) 335 334 ··· 438 437 ] 439 438 in 440 439 let info = Cmd.info "fix" ~doc ~man in 441 - Cmd.v info 442 - Term.( 443 - const fix $ chdir $ dry_run $ yes $ dirs 444 - $ Vlog.setup ~json_reporter:None "precommit") 440 + Cmd.v info Term.(const fix $ chdir $ dry_run $ yes $ dirs $ setup) 445 441 446 442 (* {1 Main} *) 447 443 ··· 465 461 ] 466 462 in 467 463 let info = Cmd.info "precommit" ~version:Monopam_info.version ~doc ~man in 468 - let default = Vlog.setup "precommit" in 464 + let default = setup in 469 465 Cmd.group info ~default [ init_cmd; status_cmd; check_cmd; fix_cmd ] 470 466 471 - let () = 472 - Memtrace.trace_if_requested (); 473 - exit (Cmd.eval main_cmd) 467 + let () = exit (Cmd.eval main_cmd)