Skip to content

Meta Doc Generators

00JCIV00 edited this page Apr 7, 2024 · 4 revisions

Meta Doc Generators take advantage of Zig's amazing build system to generate Help Documentation, Tab Completion Scripts, and Argument Templates during "build-time."

As with the rest of the library, Cova makes this easy. You can use a short, single build step to create all of your Meta Docs as seen below, or follow through to the links to learn about the various configuration options.

// Within 'build.zig'
pub fn build(b: *std.Build) void {
    // Set up your build variables as normal.

    const cova_dep = b.dependency("cova", .{ .target = target, .optimize = optimize });
    const cova_mod = cova_dep.module("cova");

    // Set up your exe step as you normally would.

    const cova_gen = @import("cova").addCovaDocGenStep(b, cova_dep, exe, .{
        .kinds = &.{ .all },
        .version = "0.10.0",
        .ver_date = "06 APR 2024",
        .author = "00JCIV00",
        .copyright = "MIT License",
    });
    const meta_doc_gen = b.step("gen-meta", "Generate Meta Docs using Cova");
    meta_doc_gen.dependOn(&cova_gen.step);
}

Check out the configurations for generating Manpages and Markdown files from your Arguments.

Take a look at the customizations for generating Tab Completion Scripts for Bash, Zsh, and Powershell!

Learn how to generate and use Argument Templates in JSON and KDL formats.