yq/pkg/yqlib/doc/Style Operator.md
2020-11-18 09:50:52 +11:00

804 B

Examples

Example 0

Given a sample.yml file of:

a: cat

then

yq eval '.a style="single"' sample.yml

will output

{a: 'cat'}

Set style using a path

Given a sample.yml file of:

a: cat
b: double

then

yq eval '.a style=.b' sample.yml

will output

{a: "cat", b: double}

Example 2

Given a sample.yml file of:

a: cat
b: dog

then

yq eval '.. style=""' sample.yml

will output

a: cat
b: dog

Example 3

Given a sample.yml file of:

a: cat
b: thing

then

yq eval '.. | style' sample.yml

will output

flow
double
single

Example 4

Given a sample.yml file of:

a: cat

then

yq eval '.. | style' sample.yml

will output