config: store some basic errors on parse

This commit is contained in:
Mitchell Hashimoto
2023-09-11 08:54:37 -07:00
parent cc13f0fe49
commit 58a43f1980
3 changed files with 79 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ const cli_args = @import("../cli_args.zig");
const Key = @import("key.zig").Key;
const KeyValue = @import("key.zig").Value;
const ErrorList = @import("ErrorList.zig");
const log = std.log.scoped(.config);
@@ -341,6 +342,11 @@ keybind: Keybinds = .{},
/// This is set by the CLI parser for deinit.
_arena: ?ArenaAllocator = null,
/// List of errors that occurred while loading. This can be accessed directly
/// by callers. It is only underscore-prefixed so it can't be set by the
/// configuration file.
_errors: ErrorList = .{},
pub fn deinit(self: *Config) void {
if (self._arena) |arena| arena.deinit();
self.* = undefined;