From c66d127c4db4a36d94225a442d427589f1545fb8 Mon Sep 17 00:00:00 2001 From: utox39 Date: Sun, 10 Aug 2025 00:41:06 +0200 Subject: [PATCH] feat(formatters): add formatter for the 'custom' module --- src/formatters.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/formatters.zig b/src/formatters.zig index 5931087..df58917 100644 --- a/src/formatters.zig +++ b/src/formatters.zig @@ -22,6 +22,7 @@ pub const formatters = [_]*const fn (allocator: std.mem.Allocator, key: []const &getFormattedNetInfo, &getFormattedTerminalNameInfo, &getFormattedLocaleInfo, + &getFormattedCustom, }; pub const default_formatters = [_]*const fn (allocator: std.mem.Allocator) anyerror!Result{ @@ -207,3 +208,7 @@ pub fn getFormattedNetInfo(allocator: std.mem.Allocator, key: []const u8, key_co return Result{ .string_arraylist = formatted_net_info_list }; } + +pub fn getFormattedCustom(allocator: std.mem.Allocator, key: []const u8, key_color: []const u8) !Result { + return Result{ .string = try std.fmt.allocPrint(allocator, "{s}{s}{s}", .{ key_color, key, ascii.Reset }) }; +}