diff options
| author | tv <tv@krebsco.de> | 2026-11-30 21:06:06 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-30 21:06:06 +0000 |
| commit | 34434f7fd5a6bab1884a63c96679f48045f4bffd (patch) | |
| tree | 7fd27022c2384a4166f97304d81d21e27a463b95 /docs | |
| parent | 598caecb7e5470e26379be4b2e199f6656ebb72c (diff) | |
config: placeholders in parentheses, for where braces are another language's
A placeholder may be written $(env:NAME), $(file:PATH) or $(cmd:COMMAND),
ending at the parenthesis matching its own: the same as with braces,
nesting and all. A configuration written in Nix, or passed through a
systemd unit, needs no escapes so.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/configuration.md | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/docs/configuration.md b/docs/configuration.md index 27b73be..e40d00e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -197,6 +197,19 @@ in shell quotes (`'...'`, `"..."`) or after a backslash don't count, so a comman hold `$`, quotes and braces of its own. `literal:` on the command line turns this off too. +A placeholder may be written with parentheses instead, `$(env:NAME)`, `$(file:PATH)`, +`$(cmd:COMMAND)`: the same, ending at the `)` that matches its `(`, parentheses +balancing and counting as braces do. So a configuration written in a language with a +`${…}` of its own, as Nix has, or passed through one (a systemd unit's `ExecStart=`), +needs no escapes there: + +```nix +{ alias = "$(env:SITE)-$(cmd:hostname -s)"; } +``` + +A command whose own parentheses don't balance outside quotes (a `case` pattern) is +written with braces. + ```sh continuum --alias 'node-${env:HOSTNAME}' ``` @@ -216,9 +229,10 @@ tor-key = "${cmd:secrets ${env:HOSTNAME} show tor}" alias = { command = ["hostname-of", "${env:SITE}"] } ``` -There, only `${env:`, `${file:` and `${cmd:` begin a placeholder, and every other `$` -stays as it is, a command's being its shell's (`$HOME`, `$(…)`, `${x:-y}`); `$${` gives -the shell a `${` that would begin one. What a placeholder gives goes in as it is, never +There, only `${env:`, `${file:` and `${cmd:` begin a placeholder, or the same with +`$(`, and every other `$` stays as it is, a command's being its shell's (`$HOME`, +`$(…)`, `${x:-y}`); `$${` and `$$(` give the shell a `${` or a `$(` that would begin +one. What a placeholder gives goes in as it is, never as something to run: * into a name, a path and an argument as text, an argument staying one argument; |
