mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Recurse doc problem
This commit is contained in:
parent
fd67748078
commit
28909bbc5a
@ -75,6 +75,11 @@ yq '[... | {"p": path | join("."), "isKey": is_key, "hc": headComment, "lc": lin
|
|||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
- p: ""
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
- p: ""
|
- p: ""
|
||||||
isKey: false
|
isKey: false
|
||||||
hc: ""
|
hc: ""
|
||||||
@ -135,6 +140,11 @@ yq '[... | {"p": path | join("."), "isKey": is_key, "hc": headComment, "lc": lin
|
|||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
- p: ""
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
- p: ""
|
- p: ""
|
||||||
isKey: false
|
isKey: false
|
||||||
hc: ""
|
hc: ""
|
||||||
@ -259,8 +269,6 @@ yq '... comments=""' sample.yml
|
|||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
# hi
|
|
||||||
|
|
||||||
a: cat
|
a: cat
|
||||||
b:
|
b:
|
||||||
```
|
```
|
||||||
|
@ -31,6 +31,7 @@ yq '..' sample.yml
|
|||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: frog
|
a: frog
|
||||||
|
a: frog
|
||||||
frog
|
frog
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -92,6 +93,7 @@ yq '...' sample.yml
|
|||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: frog
|
a: frog
|
||||||
|
a: frog
|
||||||
a
|
a
|
||||||
frog
|
frog
|
||||||
```
|
```
|
||||||
@ -109,6 +111,9 @@ yq '[..]' sample.yml
|
|||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
- a: &cat
|
||||||
|
c: frog
|
||||||
|
b: *cat
|
||||||
- a: &cat
|
- a: &cat
|
||||||
c: frog
|
c: frog
|
||||||
b: *cat
|
b: *cat
|
||||||
|
@ -25,7 +25,10 @@ func recursiveDecent(results *list.List, context Context, preferences recursiveD
|
|||||||
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
|
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
|
||||||
candidate := el.Value.(*CandidateNode)
|
candidate := el.Value.(*CandidateNode)
|
||||||
|
|
||||||
|
if candidate.Kind == DocumentNode {
|
||||||
|
results.PushBack(candidate)
|
||||||
candidate = candidate.unwrapDocument()
|
candidate = candidate.unwrapDocument()
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("Recursive Decent, added %v", NodeToString(candidate))
|
log.Debugf("Recursive Decent, added %v", NodeToString(candidate))
|
||||||
results.PushBack(candidate)
|
results.PushBack(candidate)
|
||||||
|
Loading…
Reference in New Issue
Block a user