about summary refs log tree commit diff
path: root/src/main.zig
diff options
context:
space:
mode:
authormakefunstuff <[email protected]>2024-06-30 18:10:56 +0200
committermakefunstuff <[email protected]>2024-06-30 18:10:56 +0200
commitda3127207870db7e560540f8d318ffe55cdf73a6 (patch)
treef9e45fc7c893bb5ff1864ab006f3444e6e36c9cb /src/main.zig
downloadtinkerbunk-da3127207870db7e560540f8d318ffe55cdf73a6.tar.gz
zigging some meh
Diffstat (limited to '')
-rw-r--r--src/main.zig27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
new file mode 100644
index 0000000..b46023e
--- /dev/null
+++ b/src/main.zig
@@ -0,0 +1,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", .{});
+}