fix collect

This commit is contained in:
Mike Farah
2021-11-30 13:04:32 +11:00
parent 176fec639d
commit 1085f11905
15 changed files with 413 additions and 311 deletions
+8 -1
View File
@@ -91,14 +91,21 @@ Given a sample.yml file of:
a: 1
b: 2
```
And another sample another.yml file of:
```yaml
c: 1
d: 2
```
then
```bash
yq eval 'with_entries(.key |= "KEY_" + .)' sample.yml
yq eval-all 'with_entries(.key |= "KEY_" + .)' sample.yml another.yml
```
will output
```yaml
KEY_a: 1
KEY_b: 2
KEY_c: 1
KEY_d: 2
```
## Use with_entries to filter the map
+1 -1
View File
@@ -78,7 +78,7 @@ a:
```
then
```bash
yq eval '.a.[] | select(. == "*og") | [{"path":path, "value":.}]' sample.yml
yq eval '.a[] | select(. == "*og") | [{"path":path, "value":.}]' sample.yml
```
will output
```yaml