diff --git a/src/cmd_zpm.zig b/src/cmd_zpm.zig new file mode 100644 index 0000000000000000000000000000000000000000..69ae68cb1f77f6d5a3f68d0ecd1638844e45a354 --- /dev/null +++ b/src/cmd_zpm.zig @@ -0,0 +1,32 @@ +const std = @import("std"); +const gpa = std.heap.c_allocator; + +const u = @import("./util/index.zig"); + +// +// + +const commands = struct { +}; + +pub fn execute(args: [][]u8) !void { + if (args.len == 0) { + std.debug.warn("{s}\n", .{ + \\This is a subcommand for use with https://github.com/zigtools/zpm-server instances but has no default behavior on its own aside from showing you this nice help text. + \\ + \\The default remote is https://zpm.random-projects.net/. + \\ + \\The subcommands available are: + }); + return; + } + + inline for (std.meta.declarations(commands)) |decl| { + if (std.mem.eql(u8, args[0], decl.name)) { + const cmd = @field(commands, decl.name); + try cmd.execute(args[1..]); + return; + } + } + std.debug.panic("error: unknown command \"{s}\" for \"zigmod zpm\"", .{args[0]}); +}