yq: Can't pipe into yq
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.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 24 (6 by maintainers)
I hope the defaults will change to something smarter . To just do
mycommand | yqjust likejq.Was this functionality removed? I can’t get it to work…
EDIT: Yep! Seems like this changed with v4 of
yq. Now we have to runyq evalfor things to work from stdin. I find it incredibly annoying thatevalis not the default behaviour when just runningstuff | yqsince that’s howjqworks…returns
barIn version:
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. This way, all the tools can do things as piping commands and using CLI a coherent experience.
You have made a tool to manipulate yaml. That is a good idea, and thank you for that. However, you have named the tool
yq, which obviously reflects on a very popular tooljq. It is quite natural to expect the CLI tool to behave like most CLI tools do. Furthermore, it is quite natural to expect very similar behavior tojq.Your tool, however, doesn’t behave like
jqand doesn’t behave like all other CLI tools either. If this behavior were so sane, why is there this thread filled with several attempts to understand basic functionality?The fact that this is probably a bad functionality decision is not a personal attack.
The use of
-to specify stdin processing does not seem to be mentioned in the command help. I had to find this issue to learn about it.You have to do this
yq r -. Really wish this was simpler.Also it doesn’t work reliably with tools like helm. It only returns the first yaml document, even if there are more.
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)
@mikefarahhttps://github.com/mikefarah Can you explain why you’ve deleted my post?
— Reply to this email directly, view it on GitHubhttps://github.com/mikefarah/yq/issues/113#issuecomment-1025135563, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAIZHNOAAUEE3WE72I4S2DLUYUW6NANCNFSM4EJX4FEQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://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.
Try
yq e '.' -So looks like
yq r - -d '*'is the solution to pipe toyq.if you just need something to print nice YML
Good idea - I’ll put it into the command help (for v4)
Did some black magic, and with the latest release (4.18.1) you no longer have to specify
eor-:Found when using yq
v4.40.4with pipe / stdin, flag-pis needed, otherwise there’s no output ( input format is guessed by file name suffix but there no filename for stdin?) .