mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
fixed boolean example
This commit is contained in:
parent
663413cd7a
commit
356aac5a1f
@ -32,13 +32,13 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | select(.a == "cat" or .b == "dog")' sample.yml
|
yq eval '[.[] | select(.a == "cat" or .b == "dog")]' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: bird
|
- a: bird
|
||||||
b: dog
|
b: dog
|
||||||
a: cat
|
- a: cat
|
||||||
b: fly
|
b: fly
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -22,10 +22,9 @@ var booleanOperatorScenarios = []expressionScenario{
|
|||||||
{
|
{
|
||||||
document: "[{a: bird, b: dog}, {a: frog, b: bird}, {a: cat, b: fly}]",
|
document: "[{a: bird, b: dog}, {a: frog, b: bird}, {a: cat, b: fly}]",
|
||||||
description: "Matching nodes with select, equals and or",
|
description: "Matching nodes with select, equals and or",
|
||||||
expression: `.[] | select(.a == "cat" or .b == "dog")`,
|
expression: `[.[] | select(.a == "cat" or .b == "dog")]`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"D0, P[0], (!!map)::{a: bird, b: dog}\n",
|
"D0, P[], (!!seq)::- {a: bird, b: dog}\n- {a: cat, b: fly}\n",
|
||||||
"D0, P[2], (!!map)::{a: cat, b: fly}\n",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user