← All languages

wildling

Zig library and CLI for pattern-based string generation. Zero third-party packages (Zig standard library only; hand-rolled JSON for templates). Targets Zig 0.13+.

Example

Install

From this repository:

cd zig
./build.sh
./bin/wildling "Year 19##"

Produces dist/wildling (static-friendly ReleaseSafe binary) plus dist/help.txt.

Path dependency (after cloning the monorepo):

.wildling = .{ .path = "../wildling/zig" },
const wildling = @import("wildling");

var w = try wildling.Wildling.init(allocator, &.{"Year 19##"}, &dicts);
while (try w.next(allocator)) |value| {
    std.debug.print("{s}\n", .{value});
}

CLI

./bin/wildling "Year 19##"
./bin/wildling --dictionary planets:../dictionaries/planets.txt "%{'planets'}"
./bin/wildling --template ./config.json

Help text and --check output follow docs/cli.md / docs/help.txt.

Build

./build.sh   # Docker (gcc:14-bookworm): fetch Zig into .zig if needed, zig build → dist/wildling

Project tests live in ../tests/ and are run with ../test.sh.