now assumes yaml idiomatic formatting when adding to empty maps/arrays

This commit is contained in:
Mike Farah
2022-04-15 08:27:22 +10:00
parent ea66a73f43
commit b11075ec98
7 changed files with 46 additions and 15 deletions
+3 -1
View File
@@ -135,7 +135,9 @@ a:
b:
- dog
- mouse
a3: {b: [mouse]}
a3:
b:
- mouse
```
## String concatenation
+5 -2
View File
@@ -199,7 +199,8 @@ yq '.a.b |= "bogs"' sample.yml
```
will output
```yaml
{a: {b: bogs}}
a:
b: bogs
```
## Update node value that has an anchor
@@ -229,6 +230,8 @@ yq '.a.b.[0] |= "bogs"' sample.yml
```
will output
```yaml
{a: {b: [bogs]}}
a:
b:
- bogs
```