diff options
| author | samposa_1337 <lososhome1@gmail.com> | 2026-10-30 02:18:51 +0300 |
|---|---|---|
| committer | samposa_1337 <lososhome1@gmail.com> | 2026-10-30 02:18:51 +0300 |
| commit | 90d3c27c6dfae0e293f9aa5bdae2d89dce081fd5 (patch) | |
| tree | 0ece7e061312323ecff12a9862478583abaf4620 /src/main.zig | |
| parent | d00f7d5beaf280da595e4908c9994d1dc8a80fca (diff) | |
add uptime
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 39 |
1 files changed, 26 insertions, 13 deletions
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}); } |
