From da3127207870db7e560540f8d318ffe55cdf73a6 Mon Sep 17 00:00:00 2001 From: makefunstuff Date: Sun, 30 Jun 2024 19:10:56 +0300 Subject: zigging some meh --- src/main.zig | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main.zig (limited to 'src/main.zig') 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", .{}); +} -- cgit 1.4.1-2-gfad0