Start

ChronusQL CLI

The CLI accepts query text or a query file, named input and output bindings, and optional streaming read modes. The test suite validates these argument forms.

Guide

The CLI accepts query text or a query file, named input and output bindings, and optional streaming read modes. The test suite validates these argument forms.

Query Text

bash
chronusql --query "SELECT value INTO output FROM input" --input input=input.jsonl --output output=output.jsonl

Query File and Default Input

The parser accepts a file-style invocation where `--file` binds the default input name `input`, and the remaining positional argument is the SQL file path.

bash
chronusql --file input.json query.sql

This corresponds to the tested argument array:

csharp
var args = new[] { "--file", "input.json", "query.sql" };

Named Inputs and Outputs

Multiple input and output streams are supported by repeating `--input` and `--output`:

bash
chronusql --query "SELECT value INTO output_one FROM input_one; SELECT payload.name INTO output_two FROM input_two;" \
  --input input_one=input-one.jsonl \
  --input input_two=input-two.jsonl \
  --output output_one=output-one.jsonl \
  --output output_two=output-two.jsonl

The tested SQL is:

sql
SELECT value INTO output_one FROM input_one;
SELECT payload.name INTO output_two FROM input_two;

Standard Input and Standard Output

Named bindings use `name=-` for standard streams:

bash
chronusql --query "SELECT value INTO output FROM input" --input input=- --output output=-

Only one input may use stdin, and only one output may use stdout. The tests verify that multiple stdin inputs and multiple stdout outputs are rejected.

Follow Mode

`--follow` processes existing file content and then continues watching file inputs for appended JSON:

bash
chronusql --query "SELECT value INTO output FROM input TIMESTAMP BY ts" --follow --input input=input.jsonl --output output=output.jsonl

The tested follow-mode query is:

sql
SELECT value INTO output FROM input TIMESTAMP BY ts

Follow mode is file-input only. While running, the CLI listens for `q` or `Q` on stdin to stop following.

Tail Mode

`--tail` ignores existing file content and only streams newly appended records:

bash
chronusql --query "SELECT value INTO output FROM input" --tail --input input=input.jsonl --output output=output.jsonl

In the tests, an existing row:

jsonl
{"value":10}

is not emitted when tail mode starts. Appended rows are emitted:

jsonl
{"value":11}
{"value":12}

CLI Validation

The CLI rejects:

  • Missing query SQL when neither `--query` nor a query file is provided.
  • `--follow` or `--tail` without a file input.
  • Both `--follow` and `--tail` in the same command.
  • More than one stdin input.
  • More than one stdout output.
  • SQL that references an input name with no corresponding `--input`.
  • SQL that writes to an output name with no corresponding `--output`.