Reputation: 16966
I'm just starting with the new programming language Zig and finding documentation pretty sparse.
I can build and run the current project by invoking zig build run
.
I can also do zig run src/main.zig
assuming standard project layout.
But in neither case can I find a way to pass along commandline arguments to my project.
I know that after building I can invoke my project as a binary as zig-out/bin/<my project's name> foo bar
but is there a way to do it straight from build run
?
Just trying the obvious zig build run foo bar
tells me Cannot run step 'foo' because it does not exist
.
None of the commandline switches for zig itself seem to do what I want and I can't find anyone discussing this by Googling for it.
Upvotes: 8
Views: 3392
Reputation: 829
just pass your arguments after --
(zig build run -- <args>
)
e.g:
zig build run -- foo bar
Upvotes: 15