ZPL is a simple configuration language. zq
is a simple tool for processing
streams of ZPL data.
Because we need simple configuration formats, and tools to work with them. ZPL is an excellent format, but lacks the convenience of a standalone tool for processing on the commandline.
Grab the latest version for your platform from the releases page and put it
somewhere in your $PATH
.
Given a ZPL file like this one (taken from the 4/ZPL RFC):
#
context
iothreads = 1
verbose = 1 # Ask for a trace
main
type = zmq_queue
frontend
option
hwm = 1000
swap = 25000000
subscribe = "#2"
bind = tcp://eth0:5555
backend
bind = tcp://eth0:5556
Using zq
like this:
cat example.zpl | zq main frontend
Will output this:
option hwm = 1000 swap = 25000000 subscribe = #2 bind = tcp://eth0:5555
Using zq
like this:
cat example.zpl | zq main backend bind
Will output this:
tcp://eth0:5556
zq
is written in Crystal, with no external dependencies. Building it should
be as simple as:
git clone https://github.com/colstrom/zq
cd zq
crystal build zq.cr
zq
is available under the MIT License. See LICENSE.txt
for the full text.