eb-local.sites

module eb-local.sites  src/sites.zig[source][autodoc]

Site file templates, built into the program or kept by a site in a file: eb-local site lists the built-in ones, and renders and installs either kind. A template is TOML with {{name}} placeholders, which –set name=value must fill, and {{name:default}} ones, which take the default unless set. Values go inside TOML strings, so a value with a quote, a backslash or a control character is refused.

Types

pub const Template = struct[source][autodoc]

A site file template: the name eb-local site takes, and its TOML text with placeholders.

name: []const u8[source]
text: []const u8[source]
pub const Set = struct[source][autodoc]

One --set NAME=VALUE: the placeholder it fills, and its value.

name: []const u8[source]
value: []const u8[source]
pub const Diagnostic = struct[source][autodoc]

Why a --set or a template was refused, filled in when error.Invalid is returned.

message: []const u8 = ""[source]

Error sets

pub const Error = error{Invalid} || Allocator.Error[source][autodoc]

error.Invalid when a --set or a template is refused, with the reason in the Diagnostic.

Functions

pub fn find(name: []const u8) ?Template[source][autodoc]

The built-in template called name, or null when there is none.

pub fn validValue(v: []const u8) bool[source][autodoc]

A value that stays one TOML string: printable, no quote or backslash.

pub fn parseSet(a: Allocator, arg: []const u8, d: *Diagnostic) Error!Set[source][autodoc]

Parse NAME=VALUE.

pub fn placeholders(a: Allocator, text: []const u8) Allocator.Error![]const []const u8[source][autodoc]

The names a template’s placeholders use, each once, in order.

pub fn render(a: Allocator, t: Template, sets: []const Set, d: *Diagnostic) Error![]const u8[source][autodoc]

The template with every placeholder filled. A –set naming no placeholder, or a required placeholder left unset, is an error.

Constants

pub const all = ...[source][autodoc]

The built-in templates, for no particular site; a site keeps its own in a file.