mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
1.2 KiB
1.2 KiB
Explodes (or dereferences) aliases and anchors.
Explode alias and anchor
Given a sample.yml file of:
f:
a: &a cat
b: *a
then
yq eval 'explode(.f)' sample.yml
will output
f:
a: cat
b: cat
Explode with no aliases or anchors
Given a sample.yml file of:
a: mike
then
yq eval 'explode(.a)' sample.yml
will output
a: mike
Explode with alias keys
Given a sample.yml file of:
f:
a: &a cat
*a: b
then
yq eval 'explode(.f)' sample.yml
will output
f:
a: cat
cat: b
Explode with merge anchors
Given a sample.yml file of:
foo: &foo
a: foo_a
thing: foo_thing
c: foo_c
bar: &bar
b: bar_b
thing: bar_thing
c: bar_c
foobarList:
b: foobarList_b
!!merge <<:
- *foo
- *bar
c: foobarList_c
foobar:
c: foobar_c
!!merge <<: *foo
thing: foobar_thing
then
yq eval 'explode(.)' sample.yml
will output
foo:
a: foo_a
thing: foo_thing
c: foo_c
bar:
b: bar_b
thing: bar_thing
c: bar_c
foobarList:
b: bar_b
a: foo_a
thing: bar_thing
c: foobarList_c
foobar:
c: foo_c
a: foo_a
thing: foobar_thing