cql2-cli

Crates.iocql2-cli
lib.rscql2-cli
version
sourcesrc
created_at2024-10-08 10:28:19.0183
updated_at2024-12-09 18:05:48.820746
descriptionCommand line interface for Common Query Language (CQL2)
homepagehttps://github.com/developmentseed/cql2-rs
repositoryhttps://github.com/developmentseed/cql2-rs
max_upload_size
id1401000
Cargo.toml error:TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Pete Gadomski (gadomski)

documentation

README

cql2-cli

A Command Line Interface (CLI) for Common Query Language (CQL2).

Installation

With cargo:

cargo install cql2-cli

Or from PyPI:

pip install cql2

CLI

At its simplest, the CLI is a pass-through validator:

$ cql2 < tests/fixtures/text/example01.txt # will succeed if the CQL2 is valid
("landsat:scene_id" = 'LC82030282019133LGN00')

You can convert formats:

$ cql2 -o json < tests/fixtures/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
jsonschema validation failed with file:///tmp/cql2.json#
- at '': oneOf failed, none matched
  - at '': missing properties 'op', 'args'
  - at '': missing properties 'op', 'args'
  - at '': oneOf failed, none matched
    - at '': missing properties 'op', 'args'
    - at '': missing properties 'op', 'args'
    - at '': missing properties 'op', 'args'
    - at '': missing properties 'op', 'args'
    - at '': missing properties 'op', 'args'
  - at '': missing properties 'op', 'args'
  - at '': missing properties 'op', 'args'
  - at '': missing properties 'op', 'args'
  - at '': missing properties 'op', 'args'
  - at '': want boolean, but got object

cql2-text parsing errors are pretty-printed:

$ cql2 '(foo ~= "bar")' 
[ERROR] Parsing error: (foo ~= "bar")
 --> 1:6
  |
1 | (foo ~= "bar")
  |      ^---
  |
  = expected NotFlag, And, Or, ConcatInfixOp, Add, Subtract, Multiply, Divide, Modulo, Power, Eq, Gt, GtEq, Lt, LtEq, NotEq, Is, or IsNullPostfix

Use cql2 --help to get a complete listing of the CLI arguments and formats.

More information

See the top-level README for license and contributing information.

Commit count: 109

cargo fmt