A command line script for executing EQL queries on EDN data. Powered by pyramid and babashka.
brew install lilactown/brew/eql
See https://github.com/littleli/scoop-clojure#tools
eql --query '[:foo]' '{:foo 123 :bar 456}'
Returns {:foo 123}
as the result.
Data is also accepted over STDIN, so you can do the following
echo '{:foo 123 :bar 456}' | eql --query '[:foo]'
EQL over arbitrary data can be useful as a "select-keys
on steroids" for deep
nested data.
curl -s https://pokeapi.co/api/v2/pokemon/ditto | # fetch some data
jet --from json --to edn --keywordize | # convert it from JSON to EDN
eql --query "[:id :name :height :weight \
{:abilities [{:ability [:name]}]}]" | # select just the keys we want
jet # pretty print
Outputs
{:abilities [{:ability {:name "limber"}} {:ability {:name "imposter"}}],
:height 3,
:id 132,
:name "ditto",
:weight 40}