authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-01-31 12:04:01 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-01-31 12:04:01 -08:00
log3df411d44f33f2bc6cb1ca28c3e517b249fc92fb
treebce08232f334979db04e5b3c868e5114f60b68d3
parent2f81446c110804039cdfed64240e5fac969216fb

add zpm command


1 files changed, 32 insertions(+), 0 deletions(-)

src/cmd_zpm.zig created+32
......@@ -0,0 +1,32 @@
1const std = @import("std");
2const gpa = std.heap.c_allocator;
3
4const u = @import("./util/index.zig");
5
6//
7//
8
9const commands = struct {
10};
11
12pub 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}