Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lilactown/eql-cli
A CLI for executing EQL queries on EDN data
https://github.com/lilactown/eql-cli
babashka clojure edn edn-data eql query-language
Last synced: about 2 months ago
JSON representation
A CLI for executing EQL queries on EDN data
- Host: GitHub
- URL: https://github.com/lilactown/eql-cli
- Owner: lilactown
- Created: 2022-08-08T20:52:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-09T21:55:11.000Z (over 2 years ago)
- Last Synced: 2024-08-03T13:04:37.708Z (5 months ago)
- Topics: babashka, clojure, edn, edn-data, eql, query-language
- Language: Clojure
- Homepage:
- Size: 10.7 KB
- Stars: 50
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# eql-cli
A command line script for executing [EQL](https://github.com/edn-query-language/eql)
queries on [EDN](https://github.com/edn-format/edn) data.
Powered by [pyramid](https://github.com/lilactown/pyramid) and [babashka](https://github.com/babashka/babashka).## Install
### Homebrew
```bash
brew install lilactown/brew/eql
```### Scoop
See https://github.com/littleli/scoop-clojure#tools
### Manual
* Install [babashka](https://github.com/babashka/babashka)
* Download the [eql](./eql) script and place it on your `PATH`.## Usage
```bash
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
```bash
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.```bash
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
```clojure
{:abilities [{:ability {:name "limber"}} {:ability {:name "imposter"}}],
:height 3,
:id 132,
:name "ditto",
:weight 40}
```