authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-30 13:55:56-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:35-07:00
log7819e4dea7d1bd75ee1bbb8d76bb8a8ee7672962
tree9748e4bd39ba4b3eaf05e1ca4afc95a80d90ac8b
parent8f224bc3f0065aaf971126de65b5d56d2d6d522d

rename addCliExtras to addPassthruArgs

finally, a good name

6 files changed, 15 insertions(+), 13 deletions(-)

BRANCH_TODO+1-1
......@@ -40,5 +40,5 @@ if (b.args) |args| {
4040⬇️
4141
4242```zig
43run_cmd.addCliExtras();
43run_cmd.addPassthruArgs();
4444```
lib/compiler/Maker/Step/Run.zig+2-2
......@@ -177,7 +177,7 @@ pub fn make(
177177 });
178178 argv_list.items.len += 1;
179179 },
180 .cli_extras => {
180 .passthru => {
181181 any_cli_positionals = true;
182182 if (maker.run_args) |run_args| {
183183 try argv_list.appendSlice(gpa, run_args);
......@@ -1599,7 +1599,7 @@ pub fn rerunInFuzzMode(
15991599 },
16001600 .output_file => unreachable,
16011601 .output_directory => unreachable,
1602 .cli_extras => unreachable,
1602 .passthru => unreachable,
16031603 }
16041604 }
16051605
lib/compiler/configurer.zig+2-2
......@@ -492,9 +492,9 @@ const Serialize = struct {
492492 .producer = .{ .value = null },
493493 .generated = .{ .value = a.generated_file },
494494 },
495 .cli_extras => .{
495 .passthru => .{
496496 .flags = .{
497 .tag = .cli_extras,
497 .tag = .passthru,
498498 .prefix = false,
499499 .suffix = false,
500500 .basename = false,
lib/init/build.zig+1-1
......@@ -111,7 +111,7 @@ pub fn build(b: *std.Build) void {
111111
112112 // This allows the user to pass arguments to the application in the build
113113 // command itself, like this: `zig build run -- arg1 arg2 etc`
114 run_cmd.addCliExtras();
114 run_cmd.addPassthruArgs();
115115
116116 // Creates an executable that will run `test` blocks from the provided module.
117117 // Here `mod` needs to define a target, which is why earlier we made sure to
lib/std/Build/Configuration.zig+1-1
......@@ -567,7 +567,7 @@ pub const Step = extern struct {
567567 file_content,
568568 output_file,
569569 output_directory,
570 cli_extras,
570 passthru,
571571 };
572572
573573 pub const Index = IndexType(@This());
lib/std/Build/Step/Run.zig+8-6
......@@ -142,7 +142,7 @@ pub const Arg = union(enum) {
142142 output_file_dep: *Output,
143143 output_directory: *Output,
144144 /// The arguments passed after "--" on the "zig build" CLI.
145 cli_extras,
145 passthru,
146146};
147147
148148pub const PrefixedArtifact = struct {
......@@ -517,16 +517,18 @@ pub fn addArgs(run: *Run, args: []const []const u8) void {
517517 for (args) |arg| run.addArg(arg);
518518}
519519
520/// Any extra positional args are provided to the `zig build` command, they are
521/// appended here. This causes the step to be considered to have side effects,
522/// disabling caching.
520/// Appends the extra arguments provided to `zig build` to the command line
521/// that will be passed to the process being run.
522///
523/// This causes the step to be considered to have side effects, disabling
524/// caching.
523525///
524526/// In the example command `zig build run -- arg1 arg2`, "arg1" and "arg2" will
525527/// be passed to the process being run.
526pub fn addCliExtras(run: *Run) void {
528pub fn addPassthruArgs(run: *Run) void {
527529 const graph = run.step.owner.graph;
528530 const arena = graph.arena;
529 run.argv.append(arena, .cli_extras) catch @panic("OOM");
531 run.argv.append(arena, .passthru) catch @panic("OOM");
530532}
531533
532534pub fn setStdIn(run: *Run, stdin: StdIn) void {