about summary refs log tree commit diff
path: root/src/main.zig
blob: b46023e4df709fba1c4aeaa687a5f46ccf6f1c7a (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
const std = @import("std");
const ls = @import("ls.zig");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    const allocator = gpa.allocator();
    defer _ = gpa.deinit();

    const args = try std.process.argsAlloc(allocator);
    defer std.process.argsFree(allocator, args);

    if (args.len == 2 and std.mem.eql(u8, args[1], "help")) {
        print_help();
        return;
    }
    if (args.len == 2 and std.mem.eql(u8, args[1], "ls")) {
        try ls.ls();
        return;
    }

    std.debug.print("Unknown command. Use 'help' for usage information.\n", .{});
    print_help();
}

fn print_help() void {
    std.debug.print("[usage] tinkerbunk ls\n", .{});
}