Skip to main content

Module served

Module served 

Source
Expand description

Files a repository serves, rendered from templates that declare where they go. Files a repository serves, rendered from templates that declare where they go.

A template declares its target in Jinja’s own syntax, as top-level {%- set -%} exports, instead of a manifest beside it or a mirrored directory tree:

{%- set path = "tasks/q" -%}
{%- set executable = true -%}
#!/usr/bin/env bash
#MISE tools = { "github:victor-software-house/qctl" = "{{ versions["qctl"] }}" }

path is the directory, the repository root when unsaid. name is the file name, the template’s own name without its suffix when unsaid, so most templates declare one line. executable is the one mode bit git records for a regular file: unsaid means 0644. Trim declarations with {%- … -%} so a shebang stays on line one. Any other export is the template’s own.

Rendering uses crate::surface::environment: undefined names fail, the trailing newline is kept, and ctl-core’s operator fragments are available. Which templates a repository has, and what context they see, stay with the CLI that serves them.

Structs§

ServeError
Why a template could not be served, naming the template.
Served
A rendered template and the file it serves, checked and not yet written.

Functions§

render
Render one template with context and read the file it declares.