Standard Library
length
let
list: ["a", "b", "c"]
in
length(list)map
map
list: range({ start: 5, end: 10 })
each: (item) => item * itemrange
range
start: 0
end: 10host_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_pathalways 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_pathalways 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_stringdrops thehost_path/target_pathtype 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.