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 {
1818
1919pub const server_root = "https://aquila.red";
2020
21pub fn execute(args: [][]u8) !void {
21pub fn execute(self_name: []const u8, args: [][]u8) !void {
2222 if (args.len == 0) {
2323 std.debug.print("{s}\n", .{
2424 \\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 {
3636 inline for (comptime std.meta.declarations(commands)) |decl| {
3737 if (std.mem.eql(u8, args[0], decl.name)) {
3838 const cmd = @field(commands, decl.name);
39 try cmd.execute(args[1..]);
39 try cmd.execute(self_name, args[1..]);
4040 return;
4141 }
4242 }
src/cmd/aquila/add.zig+3-1
......@@ -8,7 +8,9 @@ const aq = @import("./../aq.zig");
88//
99//
1010
11pub fn execute(args: [][]u8) !void {
11pub fn execute(self_name: []const u8, args: [][]u8) !void {
12 _ = self_name;
13
1214 const pkg_id = args[0];
1315 _ = try do(std.fs.cwd(), pkg_id);
1416 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");
88const u = @import("./../../util/index.zig");
99const 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
1214 const home = try knownfolders.getPath(gpa, .home);
1315 const homepath = home.?;
1416 const homedir = try std.fs.cwd().openDir(homepath, .{});
src/cmd/aquila/showjson.zig+3-1
......@@ -6,7 +6,9 @@ const aq = @import("./../aq.zig");
66//
77//
88
9pub fn execute(args: [][]u8) !void {
9pub fn execute(self_name: []const u8, args: [][]u8) !void {
10 _ = self_name;
11
1012 const out = std.io.getStdOut().writer();
1113
1214 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");
88const u = @import("./../../util/index.zig");
99const 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
1214 const home = try knownfolders.getPath(gpa, .home);
1315 const homepath = home.?;
1416 const homedir = try std.fs.cwd().openDir(homepath, .{});
src/cmd/ci.zig+2-1
......@@ -7,7 +7,8 @@ const common = @import("./../common.zig");
77// Inspired by:
88// 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;
1112 _ = args;
1213
1314 const gpa = std.heap.c_allocator;
src/cmd/fetch.zig+3-1
......@@ -10,7 +10,9 @@ const license = @import("./license.zig");
1010//
1111//
1212
13pub fn execute(args: [][]u8) !void {
13pub fn execute(self_name: []const u8, args: [][]u8) !void {
14 _ = self_name;
15
1416 //
1517 const gpa = std.heap.c_allocator;
1618 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");
88//
99//
1010
11pub fn execute(args: [][]u8) !void {
11pub fn execute(self_name: []const u8, args: [][]u8) !void {
12 _ = self_name;
1213 _ = args;
1314
1415 //
src/cmd/init.zig+3-1
......@@ -13,7 +13,9 @@ const u = @import("./../util/index.zig");
1313//
1414//
1515
16pub fn execute(args: [][]u8) !void {
16pub fn execute(self_name: []const u8, args: [][]u8) !void {
17 _ = self_name;
18
1719 std.debug.print("This utility will walk you through creating a zigmod.yml file.\n", .{});
1820 std.debug.print("That will give a good launching off point to get your next project started.\n", .{});
1921 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);
1414// Inspired by:
1515// 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;
1819 _ = args;
1920
2021 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");
77//
88//
99
10pub fn execute(args: [][]u8) !void {
10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
1112 _ = args;
1213
1314 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");
77//
88//
99
10pub fn execute(args: [][]u8) !void {
10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
1112 _ = args;
1213
1314 const root = @import("root");
src/cmd/zpm.zig+2-2
......@@ -29,7 +29,7 @@ pub const Package = struct {
2929 links: []const ?string,
3030};
3131
32pub fn execute(args: [][]u8) !void {
32pub fn execute(self_name: []const u8, args: [][]u8) !void {
3333 if (args.len == 0) {
3434 std.debug.print("{s}\n", .{
3535 \\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 {
4848 inline for (comptime std.meta.declarations(commands)) |decl| {
4949 if (std.mem.eql(u8, args[0], decl.name)) {
5050 const cmd = @field(commands, decl.name);
51 try cmd.execute(args[1..]);
51 try cmd.execute(self_name, args[1..]);
5252 return;
5353 }
5454 }
src/cmd/zpm/add.zig+3-1
......@@ -9,7 +9,9 @@ const zpm = @import("./../zpm.zig");
99//
1010//
1111
12pub fn execute(args: [][]u8) !void {
12pub fn execute(self_name: []const u8, args: [][]u8) !void {
13 _ = self_name;
14
1315 const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "packages" });
1416 const val = try zpm.server_fetchArray(url);
1517
src/cmd/zpm/search.zig+2-1
......@@ -7,7 +7,8 @@ const zpm = @import("./../zpm.zig");
77//
88//
99
10pub fn execute(args: [][]u8) !void {
10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
1112 _ = args;
1213
1314 const out = std.io.getStdOut().writer();
src/cmd/zpm/showjson.zig+3-1
......@@ -6,7 +6,9 @@ const zpm = @import("./../zpm.zig");
66//
77//
88
9pub fn execute(args: [][]u8) !void {
9pub fn execute(self_name: []const u8, args: [][]u8) !void {
10 _ = self_name;
11
1012 const out = std.io.getStdOut().writer();
1113
1214 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");
77//
88//
99
10pub fn execute(args: [][]u8) !void {
10pub fn execute(self_name: []const u8, args: [][]u8) !void {
11 _ = self_name;
1112 _ = args;
1213
1314 const out = std.io.getStdOut().writer();
src/main.zig+1-1
......@@ -45,7 +45,7 @@ pub fn main() !void {
4545 inline for (comptime std.meta.declarations(zigmod.commands)) |decl| {
4646 if (std.mem.eql(u8, args[0], decl.name)) {
4747 const cmd = @field(zigmod.commands, decl.name);
48 try cmd.execute(args[1..]);
48 try cmd.execute(proc_args[0], args[1..]);
4949 return;
5050 }
5151 }