Skip to Content
Like this project? Star on Github! ⭐
LanguageStandard Library

Standard Library

length

let list: ["a", "b", "c"] in length(list)

map

map list: range({ start: 5, end: 10 }) each: (item) => item * item

range

range start: 0 end: 10

host_path

Build a path on the local machine, resolved against the directory of the source file the call appears in. When the source id is itself absolute the result is absolute, so it can be forwarded across boundaries (e.g. into a sub-template) without losing its anchor.

host_path("./gitconfig")

Concatenating a string to a host_path always extends the path. Any leading / on the right is stripped, so a stray slash does not silently drop the base.

host_path("./dir") + "sub"
host_path("./dir") + "/sub"

Errors if the call appears in a source without a parent directory (e.g. an empty source id), or if the argument is not a string.

target_path

Tag an absolute path string as a path on a remote machine. Stored as a typed path so it joins like a path, not a string.

target_path("/etc/hosts")

Concatenating a string to a target_path always extends the path. Any leading / on the right is stripped, so a stray slash does not silently drop the base.

target_path("/etc") + "hosts"
target_path("/etc") + "/hosts"

Errors if the input does not start with /, or if it is not a string.

to_string

Render a value as a string. The escape hatch for paths: to_string drops the host_path / target_path type so the result can flow into a plain string field (e.g. embedding a path inside a podman volume entry like [host]:/[container]).

to_string(host_path("./foo"))

Accepts strings, paths, numbers, and booleans.

Last updated on