yaml¶
Hook for reading and writing yaml. Hook reads from path
if no data
field is provided, otherwise it writes the data
to path
.
Inputs¶
Name | Type | Default | Required | Description |
---|---|---|---|---|
path | str | True | The file path to put read or write to. | |
data | Union[dict, list, str] | None | False | Map/list or renderable string to a map/list key to write. |
Arguments¶
Position | Argument | Type |
---|---|---|
1 | path | str |
2 | data | Union[dict, list, str] |
Returns¶
Union[dict, str]
Examples¶
Read yaml¶
Read a yaml file into a key
compact->: yaml path/to/file.yaml
expanded:
->: yaml
path: path/to/file.yaml
Write yaml¶
Read a yaml file into a key
stuff:
and: things
compact->: yaml path/to/file.yaml "{{stuff}}"
expanded:
->: yaml
path: path/to/file.yaml
contents: "{{ stuff }}"