| ... | @@ -0,0 +1,32 @@ |
| 1 | const std = @import("std"); |
| 2 | const gpa = std.heap.c_allocator; |
| 3 | |
| 4 | const u = @import("./util/index.zig"); |
| 5 | |
| 6 | // |
| 7 | // |
| 8 | |
| 9 | const commands = struct { |
| 10 | }; |
| 11 | |
| 12 | pub fn execute(args: [][]u8) !void { |
| 13 | if (args.len == 0) { |
| 14 | std.debug.warn("{s}\n", .{ |
| 15 | \\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. |
| 16 | \\ |
| 17 | \\The default remote is https://zpm.random-projects.net/. |
| 18 | \\ |
| 19 | \\The subcommands available are: |
| 20 | }); |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | inline for (std.meta.declarations(commands)) |decl| { |
| 25 | if (std.mem.eql(u8, args[0], decl.name)) { |
| 26 | const cmd = @field(commands, decl.name); |
| 27 | try cmd.execute(args[1..]); |
| 28 | return; |
| 29 | } |
| 30 | } |
| 31 | std.debug.panic("error: unknown command \"{s}\" for \"zigmod zpm\"", .{args[0]}); |
| 32 | } |