authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-23 23:33:08 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-11-23 23:33:08 -08:00
log65666d00836654f33ac4405acc12ccf50f93a071
treeb887ce651247b7bf257e12674f8cea788b47ca22
parente2d42e8ff71c3e6f534a380b7d16465fa77032f7

add self_name arg to all execute() call signatures


18 files changed, 43 insertions(+), 20 deletions(-)

src/cmd/aq.zig+2-2
...@@ -18,7 +18,7 @@ pub const commands = struct {...@@ -18,7 +18,7 @@ pub const commands = struct {
1818
19pub const server_root = "https://aquila.red";19pub const server_root = "https://aquila.red";
2020
21pub fn execute(args: [][]u8) !void {21pub fn execute(self_name: []const u8, args: [][]u8) !void {
22 if (args.len == 0) {22 if (args.len == 0) {
23 std.debug.print("{s}\n", .{23 std.debug.print("{s}\n", .{
24 \\This is a subcommand for use with https://github.com/nektro/aquila instances but has no default behavior on its own aside from showing you this nice help text.24 \\This is a subcommand for use with https://github.com/nektro/aquila instances but has no default behavior on its own aside from showing you this nice help text.
...@@ -36,7 +36,7 @@ pub fn execute(args: [][]u8) !void {...@@ -36,7 +36,7 @@ pub fn execute(args: [][]u8) !void {
36 inline for (comptime std.meta.declarations(commands)) |decl| {36 inline for (comptime std.meta.declarations(commands)) |decl| {
37 if (std.mem.eql(u8, args[0], decl.name)) {37 if (std.mem.eql(u8, args[0], decl.name)) {
38 const cmd = @field(commands, decl.name);38 const cmd = @field(commands, decl.name);
39 try cmd.execute(args[1..]);39 try cmd.execute(self_name, args[1..]);
40 return;40 return;
41 }41 }
42 }42 }
src/cmd/aquila/add.zig+3-1
...@@ -8,7 +8,9 @@ const aq = @import("./../aq.zig");...@@ -8,7 +8,9 @@ const aq = @import("./../aq.zig");
8//8//
9//9//
1010
11pub fn execute(args: [][]u8) !void {11pub fn execute(self_name: []const u8, args: [][]u8) !void {
12 _ = self_name;
13
12 const pkg_id = args[0];14 const pkg_id = args[0];
13 _ = try do(std.fs.cwd(), pkg_id);15 _ = try do(std.fs.cwd(), pkg_id);
14 std.log.info("Successfully added package {s}", .{pkg_id});16 std.log.info("Successfully added package {s}", .{pkg_id});
src/cmd/aquila/install.zig+3-1
...@@ -8,7 +8,9 @@ const zigmod = @import("../../lib.zig");...@@ -8,7 +8,9 @@ const zigmod = @import("../../lib.zig");
8const u = @import("./../../util/index.zig");8const u = @import("./../../util/index.zig");
9const common = @import("./../../common.zig");9const common = @import("./../../common.zig");
1010
11pub fn execute(args: [][]u8) !void {11pub fn execute(self_name: []const u8, args: [][]u8) !void {
12 _ = self_name;
13
12 const home = try knownfolders.getPath(gpa, .home);14 const home = try knownfolders.getPath(gpa, .home);
13 const homepath = home.?;15 const homepath = home.?;
14 const homedir = try std.fs.cwd().openDir(homepath, .{});16 const homedir = try std.fs.cwd().openDir(homepath, .{});
src/cmd/aquila/showjson.zig+3-1
...@@ -6,7 +6,9 @@ const aq = @import("./../aq.zig");...@@ -6,7 +6,9 @@ const aq = @import("./../aq.zig");
6//6//
7//7//
88
9pub fn execute(args: [][]u8) !void {9pub fn execute(self_name: []const u8, args: [][]u8) !void {
10 _ = self_name;
11
10 const out = std.io.getStdOut().writer();12 const out = std.io.getStdOut().writer();
1113
12 const url = try std.mem.join(gpa, "/", &.{ aq.server_root, args[0] });14 const url = try std.mem.join(gpa, "/", &.{ aq.server_root, args[0] });
src/cmd/aquila/update.zig+3-1
...@@ -8,7 +8,9 @@ const zigmod = @import("../../lib.zig");...@@ -8,7 +8,9 @@ const zigmod = @import("../../lib.zig");
8const u = @import("./../../util/index.zig");8const u = @import("./../../util/index.zig");
9const common = @import("./../../common.zig");9const common = @import("./../../common.zig");
1010
11pub fn execute(args: [][]u8) !void {11pub fn execute(self_name: []const u8, args: [][]u8) !void {
12 _ = self_name;
13
12 const home = try knownfolders.getPath(gpa, .home);14 const home = try knownfolders.getPath(gpa, .home);
13 const homepath = home.?;15 const homepath = home.?;
14 const homedir = try std.fs.cwd().openDir(homepath, .{});16 const homedir = try std.fs.cwd().openDir(homepath, .{});
src/cmd/ci.zig+2-1
...@@ -7,7 +7,8 @@ const common = @import("./../common.zig");...@@ -7,7 +7,8 @@ const common = @import("./../common.zig");
7// Inspired by:7// Inspired by:
8// https://docs.npmjs.com/cli/v7/commands/npm-ci8// https://docs.npmjs.com/cli/v7/commands/npm-ci
99
10pub fn execute(args: [][]u8) !void {10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
11 _ = args;12 _ = args;
1213
13 const gpa = std.heap.c_allocator;14 const gpa = std.heap.c_allocator;
src/cmd/fetch.zig+3-1
...@@ -10,7 +10,9 @@ const license = @import("./license.zig");...@@ -10,7 +10,9 @@ const license = @import("./license.zig");
10//10//
11//11//
1212
13pub fn execute(args: [][]u8) !void {13pub fn execute(self_name: []const u8, args: [][]u8) !void {
14 _ = self_name;
15
14 //16 //
15 const gpa = std.heap.c_allocator;17 const gpa = std.heap.c_allocator;
16 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });18 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });
src/cmd/generate.zig+2-1
...@@ -8,7 +8,8 @@ const common = @import("./../common.zig");...@@ -8,7 +8,8 @@ const common = @import("./../common.zig");
8//8//
9//9//
1010
11pub fn execute(args: [][]u8) !void {11pub fn execute(self_name: []const u8, args: [][]u8) !void {
12 _ = self_name;
12 _ = args;13 _ = args;
1314
14 //15 //
src/cmd/init.zig+3-1
...@@ -13,7 +13,9 @@ const u = @import("./../util/index.zig");...@@ -13,7 +13,9 @@ const u = @import("./../util/index.zig");
13//13//
14//14//
1515
16pub fn execute(args: [][]u8) !void {16pub fn execute(self_name: []const u8, args: [][]u8) !void {
17 _ = self_name;
18
17 std.debug.print("This utility will walk you through creating a zigmod.yml file.\n", .{});19 std.debug.print("This utility will walk you through creating a zigmod.yml file.\n", .{});
18 std.debug.print("That will give a good launching off point to get your next project started.\n", .{});20 std.debug.print("That will give a good launching off point to get your next project started.\n", .{});
19 std.debug.print("Use `zigmod aq add <pkg>` to add a dependency from https://aquila.red/\n", .{});21 std.debug.print("Use `zigmod aq add <pkg>` to add a dependency from https://aquila.red/\n", .{});
src/cmd/license.zig+2-1
...@@ -14,7 +14,8 @@ const Map = std.StringArrayHashMap(*List);...@@ -14,7 +14,8 @@ const Map = std.StringArrayHashMap(*List);
14// Inspired by:14// Inspired by:
15// https://github.com/onur/cargo-license15// https://github.com/onur/cargo-license
1616
17pub fn execute(args: [][]u8) !void {17pub fn execute(self_name: []const u8, args: [][]u8) !void {
18 _ = self_name;
18 _ = args;19 _ = args;
1920
20 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });21 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });
src/cmd/sum.zig+2-1
...@@ -7,7 +7,8 @@ const common = @import("./../common.zig");...@@ -7,7 +7,8 @@ const common = @import("./../common.zig");
7//7//
8//8//
99
10pub fn execute(args: [][]u8) !void {10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
11 _ = args;12 _ = args;
1213
13 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });14 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });
src/cmd/version.zig+2-1
...@@ -7,7 +7,8 @@ const u = @import("./../util/index.zig");...@@ -7,7 +7,8 @@ const u = @import("./../util/index.zig");
7//7//
8//8//
99
10pub fn execute(args: [][]u8) !void {10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
11 _ = args;12 _ = args;
1213
13 const root = @import("root");14 const root = @import("root");
src/cmd/zpm.zig+2-2
...@@ -29,7 +29,7 @@ pub const Package = struct {...@@ -29,7 +29,7 @@ pub const Package = struct {
29 links: []const ?string,29 links: []const ?string,
30};30};
3131
32pub fn execute(args: [][]u8) !void {32pub fn execute(self_name: []const u8, args: [][]u8) !void {
33 if (args.len == 0) {33 if (args.len == 0) {
34 std.debug.print("{s}\n", .{34 std.debug.print("{s}\n", .{
35 \\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.35 \\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.
...@@ -48,7 +48,7 @@ pub fn execute(args: [][]u8) !void {...@@ -48,7 +48,7 @@ pub fn execute(args: [][]u8) !void {
48 inline for (comptime std.meta.declarations(commands)) |decl| {48 inline for (comptime std.meta.declarations(commands)) |decl| {
49 if (std.mem.eql(u8, args[0], decl.name)) {49 if (std.mem.eql(u8, args[0], decl.name)) {
50 const cmd = @field(commands, decl.name);50 const cmd = @field(commands, decl.name);
51 try cmd.execute(args[1..]);51 try cmd.execute(self_name, args[1..]);
52 return;52 return;
53 }53 }
54 }54 }
src/cmd/zpm/add.zig+3-1
...@@ -9,7 +9,9 @@ const zpm = @import("./../zpm.zig");...@@ -9,7 +9,9 @@ const zpm = @import("./../zpm.zig");
9//9//
10//10//
1111
12pub fn execute(args: [][]u8) !void {12pub fn execute(self_name: []const u8, args: [][]u8) !void {
13 _ = self_name;
14
13 const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "packages" });15 const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "packages" });
14 const val = try zpm.server_fetchArray(url);16 const val = try zpm.server_fetchArray(url);
1517
src/cmd/zpm/search.zig+2-1
...@@ -7,7 +7,8 @@ const zpm = @import("./../zpm.zig");...@@ -7,7 +7,8 @@ const zpm = @import("./../zpm.zig");
7//7//
8//8//
99
10pub fn execute(args: [][]u8) !void {10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
11 _ = args;12 _ = args;
1213
13 const out = std.io.getStdOut().writer();14 const out = std.io.getStdOut().writer();
src/cmd/zpm/showjson.zig+3-1
...@@ -6,7 +6,9 @@ const zpm = @import("./../zpm.zig");...@@ -6,7 +6,9 @@ const zpm = @import("./../zpm.zig");
6//6//
7//7//
88
9pub fn execute(args: [][]u8) !void {9pub fn execute(self_name: []const u8, args: [][]u8) !void {
10 _ = self_name;
11
10 const out = std.io.getStdOut().writer();12 const out = std.io.getStdOut().writer();
1113
12 const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, args[0] });14 const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, args[0] });
src/cmd/zpm/tags.zig+2-1
...@@ -7,7 +7,8 @@ const zpm = @import("./../zpm.zig");...@@ -7,7 +7,8 @@ const zpm = @import("./../zpm.zig");
7//7//
8//8//
99
10pub fn execute(args: [][]u8) !void {10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
11 _ = args;12 _ = args;
1213
13 const out = std.io.getStdOut().writer();14 const out = std.io.getStdOut().writer();
src/main.zig+1-1
...@@ -45,7 +45,7 @@ pub fn main() !void {...@@ -45,7 +45,7 @@ pub fn main() !void {
45 inline for (comptime std.meta.declarations(zigmod.commands)) |decl| {45 inline for (comptime std.meta.declarations(zigmod.commands)) |decl| {
46 if (std.mem.eql(u8, args[0], decl.name)) {46 if (std.mem.eql(u8, args[0], decl.name)) {
47 const cmd = @field(zigmod.commands, decl.name);47 const cmd = @field(zigmod.commands, decl.name);
48 try cmd.execute(args[1..]);48 try cmd.execute(proc_args[0], args[1..]);
49 return;49 return;
50 }50 }
51 }51 }