Bumping version

This commit is contained in:
Mike Farah 2022-09-09 11:23:34 +10:00
parent 05ee3403ca
commit c6394d2058
2 changed files with 34 additions and 1 deletions

View File

@ -37,7 +37,7 @@ The `=` operator then pipes the 'root' context through the `rhs` expression of `
dog
```
Both sides have now been evaluated, so now the operator copies across the value from the RHS (`.b`) to the the LHS (`.a`), and it returns the now updated context:
Both sides have now been evaluated, so now the operator copies across the value from the RHS (`.b`) to the LHS (`.a`), and it returns the now updated context:
```yaml
a: dog

View File

@ -79,3 +79,36 @@ will output
cat
```
## Update or create - entity exists
This initialises `a` if it's not present
Given a sample.yml file of:
```yaml
a: 1
```
then
```bash
yq '(.a // (.a = 0)) += 1' sample.yml
```
will output
```yaml
a: 2
```
## Update or create - entity does not exist
This initialises `a` if it's not present
Given a sample.yml file of:
```yaml
b: camel
```
then
```bash
yq '(.a // (.a = 0)) += 1' sample.yml
```
will output
```yaml
b: camel
a: 1
```