From 90d3c27c6dfae0e293f9aa5bdae2d89dce081fd5 Mon Sep 17 00:00:00 2001 From: samposa_1337 Date: Fri, 30 Oct 2026 02:18:51 +0300 Subject: add uptime --- src/main.zig | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index f334b2f..ab5ca1a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2,32 +2,45 @@ const std = @import("std"); const stat = @import("stat.zig"); const artd = @import("art.zig"); + + pub fn main() !void { const stdout = std.io.getStdOut().writer(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer _ = gpa.deinit(); + defer _ = gpa.deinit(); const allocator = gpa.allocator(); const cpuq = try stat.getcput(allocator); + defer allocator.free(cpuq); + const kernel = try stat.getkernel(allocator); + defer allocator.free(kernel); + const osd = try stat.getos(allocator); + defer allocator.free(osd); + const ram = try stat.ramInfo(allocator); + defer allocator.free(ram); + const hst = try stat.gethst(allocator); + defer allocator.free(hst); + const ge = try stat.GetRam(allocator); - const user = try stat.users(allocator); defer allocator.free(ge); + + const user = try stat.users(allocator); defer allocator.free(user); - defer allocator.free(ram); - defer allocator.free(hst); - defer allocator.free(osd); - defer allocator.free(cpuq); - defer allocator.free(kernel); + + const trm = try stat.uptime(allocator); + defer allocator.free(trm); + const art = artd.logo; try stdout.print("{s} Ezfetch\n", .{art[0]}); - try stdout.print("{s} -----------------\n", .{art[1]}); - try stdout.print("{s} Os: {s}\n", .{art[2], osd}); - try stdout.print("{s} User@hostname: {s}@{s}\n", .{art[3], user, hst}); - try stdout.print("{s} Kernel: {s}\n", .{art[4], kernel}); - try stdout.print("{s} Cpu: {s}\n", .{art[5], cpuq}); - try stdout.print(" Ram: {s} / {s} \n", .{ge, ram}); + try stdout.print("{s} -----------------\n", .{art[1]}); + try stdout.print("{s} Os: {s}\n", .{ art[2], osd }); + try stdout.print("{s} User@hostname: {s}@{s}\n", .{ art[3], user, hst }); + try stdout.print("{s} Kernel: {s}\n", .{ art[4], kernel }); + try stdout.print("{s} Cpu: {s}\n", .{ art[5], cpuq }); + try stdout.print(" Ram: {s} / {s}\n", .{ ge, ram }); + try stdout.print(" uptime: {s}\n", .{trm}); } -- cgit v1.3