feat(formatters): add getFormattedUsernameHostname function

This commit is contained in:
utox39
2025-09-13 18:36:32 +02:00
parent aab5212e6e
commit 5f6460f46e

View File

@@ -41,6 +41,17 @@ pub const default_formatters = [_]*const fn (allocator: std.mem.Allocator) anyer
&getDefaultFormattedLocaleInfo, &getDefaultFormattedLocaleInfo,
}; };
pub fn getFormattedUsernameHostname(allocator: std.mem.Allocator, color: []const u8, username: []const u8, hostname: []const u8) ![]u8 {
return try std.fmt.allocPrint(allocator, "{s}{s}{s}@{s}{s}{s}", .{
color,
username,
ascii.Reset,
color,
hostname,
ascii.Reset,
});
}
pub fn getDefaultFormattedKernelInfo(allocator: std.mem.Allocator) !Result { pub fn getDefaultFormattedKernelInfo(allocator: std.mem.Allocator) !Result {
return try getFormattedKernelInfo(allocator, "Kernel", ascii.Yellow); return try getFormattedKernelInfo(allocator, "Kernel", ascii.Yellow);
} }