Skip to content

lilactown/eql-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eql-cli

A command line script for executing EQL queries on EDN data. Powered by pyramid and babashka.

Install

Homebrew

brew install lilactown/brew/eql

Scoop

See https://github.com/littleli/scoop-clojure#tools

Manual

  • Install babashka
  • Download the eql script and place it on your PATH.

Usage

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]'

Usecases

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}