summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig39
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});
}