Split doc operator

This commit is contained in:
Mike Farah
2021-02-11 10:58:40 +11:00
parent 02ef99560d
commit 626e9cacaf
8 changed files with 89 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
# Split into Documents
This operator splits all matches into separate documents
## Split empty
Running
```bash
yq eval --null-input 'splitDoc'
```
will output
```yaml
```
## Split array
Given a sample.yml file of:
```yaml
- a: cat
- b: dog
```
then
```bash
yq eval '.[] | splitDoc' sample.yml
```
will output
```yaml
a: cat
---
b: dog
```
@@ -0,0 +1,3 @@
# Split into Documents
This operator splits all matches into separate documents