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
|
||||
```yaml
|
||||
- p: ""
|
||||
isKey: false
|
||||
hc: ""
|
||||
lc: ""
|
||||
fc: ""
|
||||
- p: ""
|
||||
isKey: false
|
||||
hc: ""
|
||||
@ -135,6 +140,11 @@ yq '[... | {"p": path | join("."), "isKey": is_key, "hc": headComment, "lc": lin
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
- p: ""
|
||||
isKey: false
|
||||
hc: ""
|
||||
lc: ""
|
||||
fc: ""
|
||||
- p: ""
|
||||
isKey: false
|
||||
hc: ""
|
||||
@ -259,8 +269,6 @@ yq '... comments=""' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
# hi
|
||||
|
||||
a: cat
|
||||
b:
|
||||
```
|
||||
|
@ -31,6 +31,7 @@ yq '..' sample.yml
|
||||
will output
|
||||
```yaml
|
||||
a: frog
|
||||
a: frog
|
||||
frog
|
||||
```
|
||||
|
||||
@ -92,6 +93,7 @@ yq '...' sample.yml
|
||||
will output
|
||||
```yaml
|
||||
a: frog
|
||||
a: frog
|
||||
a
|
||||
frog
|
||||
```
|
||||
@ -109,6 +111,9 @@ yq '[..]' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
- a: &cat
|
||||
c: frog
|
||||
b: *cat
|
||||
- a: &cat
|
||||
c: frog
|
||||
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() {
|
||||
candidate := el.Value.(*CandidateNode)
|
||||
|
||||
candidate = candidate.unwrapDocument()
|
||||
if candidate.Kind == DocumentNode {
|
||||
results.PushBack(candidate)
|
||||
candidate = candidate.unwrapDocument()
|
||||
}
|
||||
|
||||
log.Debugf("Recursive Decent, added %v", NodeToString(candidate))
|
||||
results.PushBack(candidate)
|
||||
|
Loading…
Reference in New Issue
Block a user