jid icon indicating copy to clipboard operation
jid copied to clipboard

Support for jq functions (eg `keys`)

Open DanielHeath opened this issue 9 years ago • 6 comments

Thanks for releasing this - I'm a big fan :)

Is there interest in covering off more of the jq builtins?

For instance:

echo '{"abc": 1, "abcd": 2, "Foo": 3}' | jq 'keys'
["Foo", "abc", "abcd"]

jid prevents me typing keys at all at the moment.

DanielHeath avatar Dec 06 '16 00:12 DanielHeath

This could maybe include jq as a submodule or something, to not reinvent the well

mateusduboli avatar Dec 08 '16 18:12 mateusduboli

You can use Ctrl+L to view a list of keys available at time when you're digging a query.


Shameless self-promotion: jiq, my fork of jid uses jq and supports all the fancy queries, operators and functions it offers.

fiatjaf avatar Dec 08 '16 20:12 fiatjaf

So, jid doesn't actually use jq, so this can't quite be done... :( However, @fiatjaf's jiq fork of jid does, which is pretty cool. It might be nice to have golang bindings for libjq to avoid having to create a new process every time... Oh wait! There is at least one: https://github.com/threatgrid/jq-go !

nicowilliams avatar Apr 26 '19 06:04 nicowilliams

That's awesome. I should use that in jiq but maybe it would be better if it got used on jid instead.

fiatjaf avatar Apr 26 '19 11:04 fiatjaf

@fiatjaf yeah.

I've got a branch in my jq clone that adds FFIs, I/O, co-routines, eval. After it gets integrated we'll be able to build a REPL out of eval. jid shows me that a REPL shell should really use curses so as to leave the program in the same part of the terminal screen, and show/page results in another.

nicowilliams avatar Apr 26 '19 16:04 nicowilliams

Besides the jq-go mentioned in https://github.com/simeji/jid/issues/33#issuecomment-486938365 above, there is also https://github.com/itchyny/gojq as a Go library for jq query.

FranklinYu avatar Apr 01 '23 02:04 FranklinYu