summaryrefslogtreecommitdiff
path: root/src/main.zig
blob: 6080a47ade70494f9b5f47f4564f5dfb1c4a7c30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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();
    const allocator = gpa.allocator();
    const cpuq = try stat.getcput(allocator);
    const shell = try stat.shellenv(allocator);
    defer allocator.free(shell);
    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);
    defer allocator.free(ge);
    const user = try stat.users(allocator);
    defer allocator.free(user);
    const trm = try stat.uptime(allocator);
    defer allocator.free(trm);
    const art = artd.logo;
    try stdout.print("            Ezfetch\n", .{});
    try stdout.print("{s}     -----------------\n", .{art[0]});
    try stdout.print("{s}    Os: {s}\n", .{ art[1], osd });
    try stdout.print("{s}     User@hostname: {s}@{s}\n", .{ art[2], user, hst });
    try stdout.print("{s}    Kernel: {s}\n", .{ art[3], kernel });
    try stdout.print("{s}    Cpu: {s}\n", .{ art[4], cpuq });
    try stdout.print("{s}    Ram: {s} / {s}\n", .{ art[5], ge, ram });
    try stdout.print("            larptime: {s}\n", .{trm});
    try stdout.print("            shell: {s}\n", .{shell});
}