diff --git a/README.md b/README.md index a82331c..5a5e43f 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,14 @@ pub fn main(init: std.process.Init) !void { } ``` +To see this example in action: + +```sh +zig build run +``` + +which will build examples/example.zig + ## How it works Zigmulator implements an in-memory kernel, disk, network and plugs it into your application via the new IO interface (since Zig 0.16). Multiple programs can run in the same simulation, in which case network traffic is routed between their mocks. This is a bruteforce approach but the only one that allows a complete control of the environment the applications are running in. diff --git a/build.zig b/build.zig index dfd5c1e..36ac015 100644 --- a/build.zig +++ b/build.zig @@ -20,5 +20,11 @@ pub fn build(b: *std.Build) void { }); exe.root_module.addImport("zigmulator", zigmulator); - b.installArtifact(exe); + const run_cmd = b.addRunArtifact(exe); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the example"); + run_step.dependOn(&run_cmd.step); }