mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-12 19:25:37 +00:00
Added multiple object example from PR #1226
This commit is contained in:
parent
294da55012
commit
439bcaad25
@ -86,3 +86,16 @@ will output
|
|||||||
wrap: frog
|
wrap: frog
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Creating yaml from scratch with multiple objects
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '(.a.b = "foo") | (.d.e = "bar")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b: foo
|
||||||
|
d:
|
||||||
|
e: bar
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -154,6 +154,13 @@ var collectObjectOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[], (!!map)::{wrap: {further: {name: Mike}}}\n",
|
"D0, P[], (!!map)::{wrap: {further: {name: Mike}}}\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "Creating yaml from scratch with multiple objects",
|
||||||
|
expression: `(.a.b = "foo") | (.d.e = "bar")`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[], ()::a:\n b: foo\nd:\n e: bar\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectObjectOperatorScenarios(t *testing.T) {
|
func TestCollectObjectOperatorScenarios(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user