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.

Update precommit and clean up yamlt test files

+13 -14
+10 -14
bin/main.ml
··· 6 6 let doc = "Print what would be done without making changes." in 7 7 Arg.(value & flag & info [ "n"; "dry-run" ] ~doc) 8 8 9 + let init dry_run = 10 + match Precommit.init ~dry_run () with 11 + | Ok () -> 12 + if not dry_run then 13 + print_endline "Pre-commit hooks initialized successfully." 14 + | Error msg -> 15 + Printf.eprintf "Error: %s\n" msg; 16 + exit 1 17 + 9 18 let init_cmd = 10 19 let doc = "Initialize pre-commit hooks for an OCaml project." in 11 20 let info = Cmd.info "init" ~doc in 12 - let term = 13 - Term.( 14 - const (fun dry_run -> 15 - match Precommit.init ~dry_run () with 16 - | Ok () -> 17 - if not dry_run then 18 - print_endline "Pre-commit hooks initialized successfully."; 19 - `Ok () 20 - | Error msg -> 21 - Printf.eprintf "Error: %s\n" msg; 22 - `Error (false, msg)) 23 - $ dry_run) 24 - in 25 - Cmd.v info (Term.ret term) 21 + Cmd.v info Term.(const init $ dry_run) 26 22 27 23 let default_cmd = 28 24 let doc = "Pre-commit hook initialization for OCaml projects." in
+3
test/dune
··· 1 1 (test 2 2 (name test) 3 3 (libraries precommit alcotest)) 4 + 5 + (cram 6 + (deps %{bin:precommit}))