tangled
alpha
login
or
join now
jon.recoil.org
/
day10
0
fork
atom
A fork of mtelver's day10 project
0
fork
atom
overview
issues
pulls
pipelines
Single package in a list
Mark Elvers
4 months ago
33f82dfb
88b9f8a9
+23
-15
1 changed file
expand all
collapse all
unified
split
bin
main.ml
+23
-15
bin/main.ml
···
457
457
output config results
458
458
459
459
let run_health_check_multi (config : Config.t) package_arg =
460
460
-
let packages = expand_package_arg package_arg in
461
461
-
(* Ensure output directories exist for multi-package builds *)
462
462
-
let () = Option.iter (fun path -> Os.mkdir ~parents:true path) config.json in
463
463
-
let () = Option.iter (fun path -> Os.mkdir ~parents:true path) config.md in
464
464
-
let () = Option.iter (fun path -> Os.mkdir ~parents:true path) config.dot in
465
465
-
let run_with_package pkg_name =
466
466
-
let json = Option.map (fun path -> Path.(path / pkg_name ^ ".json")) config.json in
467
467
-
let md = Option.map (fun path -> Path.(path / pkg_name ^ ".md")) config.md in
468
468
-
let dot = Option.map (fun path -> Path.(path / pkg_name ^ ".dot")) config.dot in
469
469
-
let config = { config with package = pkg_name; json; md; dot } in
470
470
-
run_health_check config
471
471
-
in
472
472
-
match config.fork with
473
473
-
| Some n -> Os.fork ~np:n run_with_package packages
474
474
-
| None -> List.iter run_with_package packages
460
460
+
match package_arg.[0] = '@' with
461
461
+
| false ->
462
462
+
(* Single package: use paths as-is (files, not directories) *)
463
463
+
let config = { config with package = package_arg } in
464
464
+
run_health_check config
465
465
+
| true ->
466
466
+
let filename = String.sub package_arg 1 (String.length package_arg - 1) in
467
467
+
let packages = Json_packages.read_packages filename in
468
468
+
(* Multiple packages: treat paths as directories *)
469
469
+
let () = Option.iter (fun path -> Os.mkdir ~parents:true path) config.json in
470
470
+
let () = Option.iter (fun path -> Os.mkdir ~parents:true path) config.md in
471
471
+
let () = Option.iter (fun path -> Os.mkdir ~parents:true path) config.dot in
472
472
+
let run_with_package pkg_name =
473
473
+
let json = Option.map (fun path -> Path.(path / pkg_name ^ ".json")) config.json in
474
474
+
let md = Option.map (fun path -> Path.(path / pkg_name ^ ".md")) config.md in
475
475
+
let dot = Option.map (fun path -> Path.(path / pkg_name ^ ".dot")) config.dot in
476
476
+
let config = { config with package = pkg_name; json; md; dot } in
477
477
+
run_health_check config
478
478
+
in
479
479
+
match config.fork with
480
480
+
| Some 1
481
481
+
| None -> List.iter run_with_package packages
482
482
+
| Some n -> Os.fork ~np:n run_with_package packages
475
483
476
484
let cache_dir_term =
477
485
let doc = "Directory to use for caching (required)" in