Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Template Functions

The full list of functions and filters registered with the minijinja environment, grouped by category. Run guisu variables to inspect what is available in a given context.

Note

Functions vs filters A function is called with parentheses: fn(arg). A filter is applied with the pipe operator: value | filter. The same underlying operation may exist as both — see the encryption row below.

System

FunctionReturnsNotes
os()string"darwin", "linux", or "windows".
arch()string"x86_64", "aarch64", "arm".
hostname()stringMachine hostname.
username()stringCurrent OS user.
home_dir()string$HOME.

Environment

FunctionReturnsNotes
env("NAME")stringEmpty string if unset.
lookPath("cmd")stringAbsolute path of cmd on $PATH, or empty if not found.

Paths

FunctionReturnsNotes
joinPath("a", "b", "c")stringJoin path components portably.

Vault (Bitwarden)

All four functions are available when the [bitwarden] provider is configured. Caching is per-apply.

FunctionReturnsNotes
bitwarden("Item")objectThe full Bitwarden item as a JSON object.
bitwardenFields("Item", "Field")valueA specific custom field on the item.
bitwardenAttachment("Item", "filename")stringAn attachment’s contents as a string.
bitwardenSecrets("Item", "Field")stringA secret field (Bitwarden Secrets only).

Templates

FunctionReturnsNotes
include("name")stringThe raw content of another template file.
includeTemplate("name")stringInclude and render a template file with the current context.

Encryption

These are filters (not functions) — they go on the right side of a |.

FilterReturnsNotes
value | decryptstringDecrypt an inline age:base64,... string.
value | encryptstringEncrypt a string for the configured recipients.
export TOKEN="{{ 'age:base64,YWdl...' | decrypt }}"

Strings

FunctionReturnsNotes
regexMatch(pattern, string)boolTrue if the regex matches anywhere.
regexReplaceAll(pattern, replacement, string)stringReplace all matches.
split(separator, string)listSplit a string into a list.
join(separator, list)stringJoin a list into a string.

String filters

FilterReturnsNotes
s | quotestringSurround with double quotes; escape inner quotes.
s | trimstringStrip leading and trailing whitespace.
s | trimStartstringStrip leading whitespace.
s | trimEndstringStrip trailing whitespace.
s | customstringUppercase the string. (Built-in alias; useful for templates.)

Data formats

FilterReturnsNotes
value | toJsonstringSerialise to JSON.
s | fromJsonvalueParse JSON.
value | toTomlstringSerialise to TOML.
s | fromTomlvalueParse TOML.

Hashing

FilterReturnsNotes
s | blake3sumstringHex-encoded BLAKE3-256 of the input.

Tip

Generated inline values Run guisu age encrypt --inline "my secret" to print an inline-encrypted value. The output can be committed safely and embedded in templates as {{ 'value' | decrypt }}.

See also