-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Can't pipe into yq #113
Comments
You have to do this
Also it doesn't work reliably with tools like helm. It only returns the first yaml document, even if there are more.
|
That's what it does by default, you can specify a specific document or all documents: http://mikefarah.github.io/yq/read/#multiple-documents-specify-a-single-document |
So looks like
|
I hope the defaults will change to something smarter . To just do |
Was this functionality removed? I can't get it to work... EDIT: Yep! Seems like this changed with v4 of |
echo -e '---
foo: bar
buzz: 42
' | yq e '.foo' - returns In version: $ yq --version
yq version 4.5.0 |
@RSwarnkar cat tmp.yaml | yq -C r -
|
The use of |
Good idea - I'll put it into the command help (for v4) |
Has anyone figured out how to do this with V4? |
Sorry to hear that, the documentation is referenced from this page, you can select the correct version on the RHS, the default is version 4.
For what it's worth, I've just added reading from STDIN as an example in the quick guide of the Github readme. |
Try |
Thanks @sezu . I keep coming back here via google trying to figure out how to do this repeatedly as this is so anti-intuitive. |
Did some black magic, and with the latest release (4.18.1) you no longer have to specify cat file.yml | yq |
@mikefarah Can you explain why you've deleted my post? |
It was a rude and entitled post, but i deleted soecifically because you said no one sane would use yq, which I take as a personal atttack against me and users of yq.
I understand, and am sorry that you were frustrated, but I do not tolerate posts like that. See the the code of conduct in the repo for more information.
Fixed: repo not report
…________________________________
From: petrmvala ***@***.***>
Sent: Sunday, January 30, 2022 11:43:18 PM
To: mikefarah/yq ***@***.***>
Cc: Mike Farah ***@***.***>; Mention ***@***.***>
Subject: Re: [mikefarah/yq] Can't pipe into yq (#113)
@mikefarah<https://github.com/mikefarah> Can you explain why you've deleted my post?
—
Reply to this email directly, view it on GitHub<#113 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAIZHNOAAUEE3WE72I4S2DLUYUW6NANCNFSM4EJX4FEQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@mikefarah Thank you for volunteering your time to work on this project. This latest fix is very welcome and makes it more pleasant to use for us pseudo-sane people. :) For those unhappy few, I'm sure you are welcome to contribute patches, fork, or start your own alternative project. |
There was nothing rude about the post I made. I barely mentioned that 99.9% of macos/linux tools work the same way and use the same verb structure. You have made a tool to manipulate yaml. That is a good idea, and thank you for that. However, you have named the tool Your tool, however, doesn't behave like The fact that this is probably a bad functionality decision is not a personal attack. |
I was able to Anyone know which switch to use to remove the "-" from the output? FYI - I am on 4.16.1 and I still had to use the "e" eval directive to get yq working with piped curl output. |
Found when using yq # check yq version
yq -V
# prepare test data
xml='
<project>
<profiles>
<profile><id>aaa</id></profile>
<profile><id>bbb</id></profile>
<profile><id>ccc</id></profile>
</profiles>
</project>
'
echo $xml > /tmp/a.xml
# test 1 : worked
echo $xml | yq eval -p xml -o json '.project.profiles.profile[].id'
# test 2 : worked
yq eval -p xml -o json '.project.profiles.profile[].id' < /tmp/a.xml |
I feel like if no file is specified, yq should be like jq and default to reading from stdin. |
Piping into yq with
my.yml | yq
does not seem to work, which limits usability for scripting on linux severely. This needs to be supported.The text was updated successfully, but these errors were encountered: