Skip to content

append

Source

Hook for updating dict objects with items.

Inputs

Name Type Default Required Description
src Union[list, str] True A list append to and output the result or a str with separators or list for a key path to the element to append to within the context.
src_is_key_path bool False True If the src is a list and is meant to be a key path.
sep str / True For string src's, a separator for key path.
item Any True An item to append to a list.

Arguments

Position Argument Type
1 src Union[list, str]
2 item Any

Returns

Optional[list]

Examples

Taking a literal input

list:
  - stuff
result->: append {{path.to.list}} things

list:
  - stuff
result:
  - stuff
  - things

Or modifying the context

list:
  - stuff
append in place_>: append path/to/list 0

list:
  - stuff
  - things

Expanded in place

list:
  - stuff
append in place:
  _>: append
  src: path/to/list
  item: things

list:
  - stuff
  - things

Expanded literal

list:
  - stuff
appended:
  _>: append
  src: "{{list}}"
  item: things

list:
  - stuff
appended:
  - stuff
  - things