Skip to the content.

fetch command

zigmod fetch

For a full reference on the fields available in deps.zig you can check here.

Adding deps.zig to your build.zig

 const std = @import("std");
+const deps = @import("./deps.zig");
 
 pub fn build(b: *std.build.Builder) void {
     const target = b.standardTargetOptions(.{});
 
     const mode = b.standardReleaseOptions();
 
     const exe = b.addExecutable("hello", "src/main.zig");
     exe.setTarget(target);
     exe.setBuildMode(mode);
+    deps.addAllTo(exe);
     exe.install();

Screenshot

image

In addition to fetching your dependencies fetch will help you track any updates.

In the event you are using Git, fetch will parse the diff of your committed zigmod.lock with the new one it just printed and give you a status update on new packages, removed packages, or updated packages. If a dependency happens to be hosted on a major Git provider, then it will also reformat the updates section to print a compare URL so you may visit it in a browser and view the changes directly. Else, it will still print the β€œfrom” and β€œto” commits.