CLI
cql2-rs includes a command-line interface (CLI).
Installation
Install from PyPI:
Or, if you have Rust:
Usage
At its simplest, the CLI is a pass-through validator:
$ cql2 < examples/text/example01.txt # will succeed if the CQL2 is valid
landsat:scene_id = 'LC82030282019133LGN00'
You can convert formats:
$ cql2 -o json < examples/text/example01.txt
{"op":"=","args":[{"property":"landsat:scene_id"},"LC82030282019133LGN00"]}
Use -v to get detailed validation information:
$ cql2 'wrong' -v
[ERROR] Invalid CQL2: wrong
For more detailed validation information, use -vv
{"property":"wrong"} is not valid under any of the schemas listed in the 'oneOf' keyword
cql2-text parsing errors are pretty-printed:
$ cql2 '(foo ~= "bar")'
[ERROR] Parsing error: (foo ~= "bar")
--> 1:6
|
1 | (foo ~= "bar")
| ^---
|
= expected NotFlag, And, Or, Add, Subtract, Multiply, Divide, Modulo, Power, Eq, Gt, GtEq, Lt, LtEq, NotEq, or IsNullPostfix
Use cql2 --help to get a complete listing of the CLI arguments and formats.