feat: print every config error message

This commit is contained in:
Remi Gelinas
2024-07-17 17:03:09 -04:00
parent 368868f712
commit a546da0417

View File

@ -42,14 +42,17 @@ pub fn run(alloc: std.mem.Allocator) !u8 {
const abs_path = try std.fs.cwd().realpath(config_path, &buf); const abs_path = try std.fs.cwd().realpath(config_path, &buf);
try cfg.loadFile(alloc, abs_path); try cfg.loadFile(alloc, abs_path);
if (!cfg._errors.empty()) {
try stdout.print("Config is not valid path={s}", .{config_path});
return 1;
}
} else { } else {
try cfg.loadDefaultFiles(alloc); try cfg.loadDefaultFiles(alloc);
} }
return 0; if (!cfg._errors.empty()) {
for (cfg._errors.list.items) |err| {
try stdout.print("{s}\n", .{err.message});
}
return 1;
}
return 1;
} }