Skip to content

feat(coreutils): add the tmpl applet, on a shared renderer - #444

Closed
raphaelvigee wants to merge 1 commit into
raphaelvigee/coreutils-sedfrom
raphaelvigee/coreutils-tmpl
Closed

raphaelvigee wants to merge 1 commit into
raphaelvigee/coreutils-sedfrom
raphaelvigee/coreutils-tmpl

Conversation

@raphaelvigee

Copy link
Copy Markdown
Member

@raphaelvigee
raphaelvigee force-pushed the raphaelvigee/coreutils-sed branch from 1cd7454 to 1dedd2a Compare August 29, 2026 22:44
@raphaelvigee
raphaelvigee force-pushed the raphaelvigee/coreutils-tmpl branch from 21f261c to f328a20 Compare August 29, 2026 22:44
@raphaelvigee
raphaelvigee force-pushed the raphaelvigee/coreutils-sed branch from 1dedd2a to a8bd0a9 Compare September 3, 2026 16:26
@raphaelvigee
raphaelvigee force-pushed the raphaelvigee/coreutils-tmpl branch from f328a20 to 49acb17 Compare September 3, 2026 16:26
The `template` rule is the surface to reach for — declared inputs, no
subprocess. `tmpl` exists for what the rule cannot express: filling in a
file *during* a recipe, from values the recipe computed, which is
otherwise done with `sed -i` or `envsubst`.

`tmpl [-i IN] [-o OUT] [--set NAME=VALUE]... [--env]`, stdin to stdout by
default. `--set` wins over `--env`: the environment is the broad default
and each `--set` is a deliberate override.

The rendering moves to `crates/template`, shared with the driver, rather
than being copied. It is small enough to be tempting to copy and exactly
the wrong thing to copy: strict undefined behaviour and the absent
template loader are *configuration*, and configuration in two places
drifts — a loader enabled on one side and not the other would be a
sandbox hole nobody notices. The crate depends on minijinja alone, so
`builtins` does not gain the forty utility crates to reuse it.

TEMPLATE_FORMAT_VERSION 1 -> 2 while moving it: minijinja drops a
template's trailing newline by default, and these render *files*. A
config file that has lost its final newline is wrong, and every diff
against it is noisy.

COREUTILS_VERSION 4 -> 5: the applet set changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181d7hhbYWXT42Z1KQPM29Q
@raphaelvigee

Copy link
Copy Markdown
Member Author

Superseded by consolidation. The applet halves of this PR (#442 tar/gzip/zstd, #443 sed, #444's tmpl) now land in two PRs instead of four:

No content was dropped — the restacked tree is byte-identical to the eight-commit version, and every layer builds, lints and passes its unit tests on its own. Fewer layers also matters now that stacked PRs get no CI unless labelled (#449).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant