From 9f64a8d003bd301a6499bf7a6f60e6cf0b533162 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 2 Dec 2026 17:50:30 +0000 Subject: config: a named importer used with several variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a file, { NAME = { host = "…", key = "…" } } uses the importer NAME with those variables; { NAME = "REST" } is short for the one variable `name`, which the argument and the placeholder give. A variable the importer is given and never asks for is an error naming it and those it takes, as one it asks for and isn't given is; one that takes none is used with nothing after its name. Such a use is shown as NAME(host = …, key = …), as written, and Source::Named holds the variables, for a program that reports by them. --- docs/configuration.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/configuration.md') diff --git a/docs/configuration.md b/docs/configuration.md index 79e5965..b286463 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -301,6 +301,23 @@ itself. What follows the name goes in as every variable does: as it is, one argu one word of a shell command, never as something to run. It may hold placeholders, and an importer may be defined through others named, but not through itself. +In a file, an importer may be used with several variables, a table of them in place of +the text, each named as importers are: + +```toml +[meta.importer] +secrets = { command = ["secrets", "$(var:host)", "show", "$(var:key)"] } + +tor-key = { secrets = { host = "web", key = "tor" } } +``` + +`{ NAME = "REST" }` is short for `{ NAME = { name = "REST" } }`. A variable the importer +asks for and isn't given is an error that names it, and so is one it is given and never +asks for, a misspelt one most likely; one that takes none is used with nothing after +its name (`{ NAME = "" }`, `NAME:`). An importer's own relative paths, and where its +commands run, go by the file that names it; those in what it is used with, by the file +that uses it. + A name is small letters, digits and `-`, a letter first, and none of `env`, `file`, `cmd`, `command`, `var`, `literal` and `format`. Where it isn't named, `pass:x` is what it was before: text on the command line, an unknown key in a file. -- cgit v1.3.1