summaryrefslogtreecommitdiff
path: root/src/main.zig
blob: 356758aab94056d7e237b406bdbc0bcc526b0cdf (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
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 wm = try st.getwm(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("          -----------------\n", .{});
    try stdout.print("{s}        Os: {s}\n", .{ art[0], osg });
    try stdout.print("{s}       Username@hostname: {s}@{s}\n", .{ art[1], user, hostname });
    try stdout.print("{s}      Kernel: {s}\n", .{ art[2], ke });
    try stdout.print("{s}     Cpu: {s}\n", .{ art[3], cpu });
    try stdout.print("{s}    Ram: {s} / {s} \n", .{ art[4], ramq, ram });
    try stdout.print("{s}      DE/WM: {s}\n", .{ art[5], wm });
    try stdout.print("                 larptime: {s}\n", .{uptime});
    try stdout.print("                 shell: {s}\n", .{shell});
    try stdout.flush();
}