-
-
Notifications
You must be signed in to change notification settings - Fork 593
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
replaceability of pip yq? #193
Comments
I like the idea of that, having the same CLI api - hadn't actually thought of it. At the moment I'm using the cobra go lang package to handle arguments, which is where is gets that subcommand syntax. Mind you I think that's actually more typical of cli apps to have '-' arguments as flags to a command/subcommand rather than subcommands - but anyway as you say that how both jq and the other yq work. Have to give this some thought. |
I prefere this yq interface, but it lacks YAML anchor support :( It is possible for both project to work on redefining the name so there is no conflict (I install this yq in /usr/local/bin/yyq)? |
So, can we just bring the same solution of the mentioned kislyuk/yq version? He just wraps jq inside it, so it is why it has all the jq flags. You can use the jq filter feature for now and try to port later. |
For anyone that reaches this card, here is a workaround: yq r -j file.yq | jq $filter_command | yq - |
The (albeit moonshot) point of yq is to have it dependency free - so I don't want to wrap jq (there are other utilities that do this already. That said, if you already have jq (or don't mind installing it) piping totally works |
I saw this similar discussion in jq issues and they have some other solutions. One is quite interesting and owe attention. EDIT:
|
So, checking the latest it has standalone binaries that will make your life easier. Forget pip. wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x jq
yq r -j file.yq | jq $filter_command | yq - |
The binary itself requires Also will install
|
Latest v4 version now supports jq like syntax (though not everything jq can do yet) |
We use a lot of the pip version of
yq
because it actually feels like justjq
for yaml (same handling of flags etc). However, there's a lot of confusion because the default version on brew is this, but on linux it's the python one, and there are incompatibilities. Here's the first one we hit:python-yq
supports-r
for reading raw valuejq
supports-r
for reading raw valuer
as a subcommandAny thoughts on possibly consolidating the CLI api for these things?
Edit: I know this is a big ask and probably should just be insta-closed. I was just wondering what you guys thought on this issue.
EDIT: 2023 if this matters to you, check out https://github.com/clux/whyq
The text was updated successfully, but these errors were encountered: