Skip to content

Templating

Strings in a config can carry ${…} tokens that are filled in when they're used. Which tokens work depends on where the string is and when it's used. The full list is in Reference → Templating.

The namespaces

Token Comes from Typical use
${env.NAME} the environment, including boot prompts tokens, hosts, user choices
${params.NAME} values a caller binds to a source reusable source definitions
${selection…} the row a binding or push started from bind:, confirm:, a pushed screen
${cursor…} the live cursor of an on_cursor driver on_cursor.bind
${inputs.NAME} an action's inputs, after the form an action's argv, URL, body, messages
${body.PATH} an action's JSON response message:, error_message:
${window.*} the page or edge a windowed source is asked for a windowed exec command, an Anchored http body / older / newer

${selection} alone is a list's item or a table's first cell; ${selection.Name} is the cell in the column titled Name, and ${selection.2} the second cell. ${cursor…} works the same way. On an eventlog item, ${selection} is the item's key and every field is a path: ${selection.event}, ${selection.event_data.host}.

Keep sources reusable

Let sources use only ${params.*} and ${env.*}, and map rows onto parameters in bind::

data:
  sources:
    pod:
      type: http
      parameters: {namespace: {required: true}, name: {required: true}}
      url: http://localhost:8001/api/v1/namespaces/${params.namespace}/pods/${params.name}

The same pod source then serves a push binding, an on_cursor detail pane, a join lookup and wrangl --param, unchanged.

Dot-paths

root:, a column's value: and an inspector field's path: name data with dot-paths: metadata.name, items.0.status. A missing step gives an empty value, not an error. Where a field accepts a list of paths, the first non-empty one wins.

Expressions

Pipeline operators, an action's success:, activity.busy_when and window.growing.while take expr-lang expressions. An item's fields are in scope directly:

where: "status.phase == 'Running' && len(spec.containers) > 1"
compute:
  short_name: "lower(metadata.name)"
by: "status.containerStatuses[0].restartCount"

A plain text line is item (item contains 'ERROR'), and an operator's own parameters are params.NAME.