summaryrefslogtreecommitdiff
path: root/src/main.zig
blob: fb351999f00f3d31cfa2864cb073f8b726887025 (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
const std = @import("std");
const Io = std.Io;
const st = @import("stat.zig");
const artd = @import("art.zig");
pub fn main(init: std.process.Init) !void {
    const allocator = init.arena.allocator();
    const ke = try st.getkernel(init.io ,allocator);
    const cpu = try st.getcpu(init.io ,allocator);
    const osg = try st.getos(init.io ,allocator);
    const ram = try st.getram(init.io ,allocator);
    const ramq = try st.gettotal(init.io ,allocator);
    const uptime = try st.uptime(init.io ,allocator);
    const user = try st.getuser(init.environ_map ,allocator);
    const shell = try st.getshell(init.environ_map ,allocator);

    const hostname = try st.gethostname(init.io ,allocator);
     var bufs: [1024]u8 = undefined;
     var stdw = Io.File.stdout().writer(init.io, &bufs);
        const stdout = &stdw.interface;
            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],osg});
        try stdout.print("{s}    Username@hostname: {s}@{s}\n", .{art[2],user,hostname});
        try stdout.print("{s}   Kernel: {s}\n", .{art[3],ke});
        try stdout.print("{s}   Cpu: {s}\n", .{art[4],cpu});
        try stdout.print("{s}   Ram: {s} / {s} \n", .{art[5],ramq,ram});
        try stdout.print("           larptime: {s}\n", .{uptime});
        try stdout.print("           shell: {s}\n", .{shell});
        try stdout.flush();
}