mikefarah / yq

yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor

Home Page:https://mikefarah.gitbook.io/yq/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Head comments retrieval incomplete from list of objects

fpfuetsch opened this issue · comments

Describe the bug
I have a list of yaml objects (each containing a head comment) from which I want to retrieve these comments. Unfortunately the comments are "empty" after as the first non-empty object.

Version of yq: 4.43.1
Operating system: mac
Installed via: homebrew

Input Yaml

input.yaml:

# firstComment
---
# secondComment
key: value
---
# thirdComment
otherKey: otherValue
---
# fourthComment

Command
The command you ran:

yq eval-all '. | head_comment' input.yaml

Actual behavior

firstComment
secondComment

Expected behavior

firstComment
secondComment
thirdComment
fourthComment

Probably a duplicate of #1007