I want to merge two yaml documents with the result containing
- all mapped values (with the last one taking precedence)
- concatenated arrays
e.g. given this file
# file1.yml
animals:
- elephant
donkey
flavours:
sour:
- lemon
sweet:
- chocolate
strange: true
and this file
#file2.yml
animals:
- monkey
pelican
flavours:
sweet:
- vanilla
strange: false
the result should contain all the nodes, with merged arrays and values that are not arrays from the last file
#result.yml
animals:
- elephant
donkey
monkey
pelican
flavours:
sour:
- lemon
sweet:
- chocolate
vanilla
strange: false
Can yq do this, maybe?