I am trying to add new arrays to the existing yml file
for example the test.yml looks like this
visibility:
subscribe:
enabled: true
type: authenticated
view:
enabled: true
type: public
and I am trying to modify it to look like this
visibility:
subscribe:
tags: []
orgs: []
enabled: true
type: authenticated
view:
tags: []
orgs: []
enabled: true
type: public
I have used yq to do that but there seems to be an issue it does not add any new field Here is the bash script I made
yq '.visibility.subscribe |= {"orgs":"[]"} + .' test.yml
yq '.visibility.subscribe |= {"tags":"[]"} + .' test.yml
yq '.visibility.view |= {"orgs":"[]"} + .' test.yml
yq '.visibility.view |= {"tags":"[]"} + .' test.yml
Am I using the right logic ?