mirror of
https://github.com/ziglang/zig.git
synced 2024-11-24 21:30:14 +00:00
Updated FAQ (markdown)
parent
998c45e5b4
commit
bf6f10e50b
16
FAQ.md
16
FAQ.md
@ -134,9 +134,12 @@ You can also pass `-fno-sanitize=undefined`.
|
|||||||
|
|
||||||
## How to add command-line args to `zig build run` sub-command?
|
## How to add command-line args to `zig build run` sub-command?
|
||||||
|
|
||||||
in `build.zig`...
|
#### usage
|
||||||
|
```sh
|
||||||
|
zig build run -- one two three
|
||||||
|
```
|
||||||
|
|
||||||
#### `zig build run -- one two three`
|
#### edit `build.zig`
|
||||||
```zig
|
```zig
|
||||||
const run_cmd = exe.run();
|
const run_cmd = exe.run();
|
||||||
if (b.args) |args| run_cmd.addArgs(args);
|
if (b.args) |args| run_cmd.addArgs(args);
|
||||||
@ -144,10 +147,13 @@ if (b.args) |args| run_cmd.addArgs(args);
|
|||||||
|
|
||||||
## How to tie a `zig build run` sub-command to custom `-D` style options
|
## How to tie a `zig build run` sub-command to custom `-D` style options
|
||||||
|
|
||||||
in `build.zig`...
|
#### usage
|
||||||
|
```sh
|
||||||
|
zig build run -Dhello=false
|
||||||
|
zig build run -Dhello=true
|
||||||
|
```
|
||||||
|
|
||||||
#### `zig build run -Dhello=false`
|
#### edit `build.zig`
|
||||||
#### `zig build run -Dhello=true`
|
|
||||||
```zig
|
```zig
|
||||||
exe.addBuildOption(bool, "hello", hello);
|
exe.addBuildOption(bool, "hello", hello);
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user