Write
Updates all the matching nodes of path expression in a yaml file to the supplied value.
Last updated
Was this helpful?
Updates all the matching nodes of path expression in a yaml file to the supplied value.
Last updated
Was this helpful?
See docs for and for more details, including controlling quotes and tags.
Given a sample.yaml file of:
then
will output:
will update the sample.yaml file so that the value of 'c' is cat.
Any missing fields in the path will be created on the fly.
Given a sample.yaml file of:
then
will output:
Given a sample.yaml file of:
then
will output:
Note that the path is in quotes to avoid the square brackets being interpreted by your shell.
Given a sample.yaml file of:
then
will output:
Given a sample.yaml file of:
then
will output:
The ---anchorName
flag can be used to set the anchor name of a node
Given a sample document of:
Then:
Will yield
The --makeAlias
flag can create (or update) a node to be an alias to an anchor.
Given a sample file of:
Then
Will yield:
You can use the write command to update the quoting style of nodes, or their tags, without re-specifying the values. This is done by omitting the value argument:
Given a sample document:
Then
Will yield:
Given a sample.yaml file of:
and a script update_instructions.yaml of:
then
will output:
And, of course, you can pipe the instructions in using '-':