Zig library for URI Templating
See examples directory
Create a new exec project with zig init
then update build.zig.zon
by running.
zig fetch --save https://github.com/softprops/uri-template/archive/refs/tags/v0.1.1.tar.gz
you can also depend any tag with
https://github.com/softprops/uri-template/archive/refs/tags/v{version}.tar.gz
or current main withhttps://github.com/softprops/uri-template/archive/refs/heads/main/main.tar.gz
. to resolve a hash omit it and let zig tell you the expected value.
Add the following in your build.zig
file
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// π de-reference dep from build.zig.zon
+ const uritemplate = b.dependency("uritemplate", .{
+ .target = target,
+ .optimize = optimize,
+ }).module("uritemplate");
var exe = b.addExecutable(.{
.name = "your-exe",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
// π add the module to executable
+ exe.root_mode.addImport("uritemplate", uritemplate);
b.installArtifact(exe);
}
Does this look interesting but you're new to zig and feel left out? No problem, zig is young so most us of our new are as well. Here are some resources to help get you up to speed on zig
- softprops 2024