feat(config): add username_hostname_color field and getUsernameHostname function

This commit is contained in:
utox39
2025-09-13 18:33:04 +02:00
parent abff59b7d6
commit aab5212e6e

View File

@@ -10,6 +10,7 @@ pub const Module = struct {
pub const Config = struct { pub const Config = struct {
ascii_abs_path: ?[]u8 = null, ascii_abs_path: ?[]u8 = null,
username_hostname_color: ?[]u8 = null,
modules: []Module, modules: []Module,
}; };
@@ -36,6 +37,12 @@ pub fn getAsciiPath(config: ?std.json.Parsed(Config)) ?[]u8 {
} else return null; } else return null;
} }
pub fn getUsernameHostnameColor(config: ?std.json.Parsed(Config)) ?[]u8 {
if (config) |c| {
return c.value.username_hostname_color;
} else return null;
}
pub fn getModulesTypes(allocator: std.mem.Allocator, config: ?std.json.Parsed(Config)) !std.array_list.Managed(ModuleType) { pub fn getModulesTypes(allocator: std.mem.Allocator, config: ?std.json.Parsed(Config)) !std.array_list.Managed(ModuleType) {
var modules_list = std.array_list.Managed(ModuleType).init(allocator); var modules_list = std.array_list.Managed(ModuleType).init(allocator);