also looking at this
feat: load strict JSON configuration files
#19
10 files
+249
-286
| @@ -71,6 +71,20 @@ pub fn main(init: std.process.Init.Minimal) !void { | ||
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | // Configuration establishes defaults; parsing the arguments again makes | |
| 75 | // every explicitly supplied CLI flag take precedence. | |
| 76 | var config_loader = lib.ConfigLoader.init(allocator); | |
| 77 | defer config_loader.deinit(); | |
| 78 | if (cli_parser.options.config) |config_path| { | |
| 79 | const config = config_loader.loadFromFile(config_path) catch |err| { | |
| 80 | std.debug.print("Error: invalid configuration '{s}': {s}\n", .{ config_path, @errorName(err) }); | |
| 81 | std.process.exit(2); | |
| 82 | }; | |
| 83 | cli_parser = lib.CLI.init(allocator); | |
| 84 | try cli_parser.applyConfig(config); | |
| 85 | try cli_parser.parse(args); | |
| 86 | } | |
| 87 | ||
| 74 | 88 | // Check if we should use test discovery or programmatic tests |
| 75 | 89 | const use_discovery = cli_parser.options.test_dir != null; |
| 76 | 90 | |