1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Added to_entries op

This commit is contained in:
Mike Farah
2021-05-09 13:59:23 +10:00
parent ae4b606707
commit 77630ca179
5 changed files with 137 additions and 0 deletions

37
pkg/yqlib/doc/Entries.md Normal file
View File

@@ -0,0 +1,37 @@
## to_entries Map
Given a sample.yml file of:
```yaml
a: 1
b: 2
```
then
```bash
yq eval 'to_entries' sample.yml
```
will output
```yaml
- key: a
value: 1
- key: b
value: 2
```
## to_entries Array
Given a sample.yml file of:
```yaml
- a
- b
```
then
```bash
yq eval 'to_entries' sample.yml
```
will output
```yaml
- key: 0
value: a
- key: 1
value: b
```