Skip to content

Commit db61c3e

Browse files
committed
fix missing args parse
1 parent 2afed76 commit db61c3e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

compiled_starters/zig/build.zig

+6
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ pub fn build(b: *std.Build) void {
2424
// This will evaluate the `run` step rather than the default, which is "install".
2525
const run_step = b.step("run", "Run the app");
2626
run_step.dependOn(&run_cmd.step);
27+
28+
// This allows the user to pass arguments to the application in the build
29+
// command itself, like this: `zig build run -- arg1 arg2 etc`
30+
if (b.args) |args| {
31+
run_cmd.addArgs(args);
32+
}
2733
}

solutions/zig/01-jm1/code/build.zig

+6
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ pub fn build(b: *std.Build) void {
2424
// This will evaluate the `run` step rather than the default, which is "install".
2525
const run_step = b.step("run", "Run the app");
2626
run_step.dependOn(&run_cmd.step);
27+
28+
// This allows the user to pass arguments to the application in the build
29+
// command itself, like this: `zig build run -- arg1 arg2 etc`
30+
if (b.args) |args| {
31+
run_cmd.addArgs(args);
32+
}
2733
}

starter_templates/zig/build.zig

+6
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ pub fn build(b: *std.Build) void {
2424
// This will evaluate the `run` step rather than the default, which is "install".
2525
const run_step = b.step("run", "Run the app");
2626
run_step.dependOn(&run_cmd.step);
27+
28+
// This allows the user to pass arguments to the application in the build
29+
// command itself, like this: `zig build run -- arg1 arg2 etc`
30+
if (b.args) |args| {
31+
run_cmd.addArgs(args);
32+
}
2733
}

0 commit comments

Comments
 (0)