Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Head comments retrieval incomplete from list of objects #2022

Open
fpfuetsch opened this issue Apr 29, 2024 · 1 comment
Open

Head comments retrieval incomplete from list of objects #2022

fpfuetsch opened this issue Apr 29, 2024 · 1 comment
Labels

Comments

@fpfuetsch
Copy link

fpfuetsch commented Apr 29, 2024

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
@fpfuetsch
Copy link
Author

Probably a duplicate of #1007

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant