Skip to content

Command line guide

Use the Lutra CLI when you want to:

  • explore data interactively,
  • check projects for errors,
  • run programs locally and remotely.

For all commands and option, see the CLI reference.

Install the CLI

Using Nix

If you use Nix, install the CLI with:

$ nix profile install 'git+https://codeberg.org/lutra/lutra-data.git'

Using Cargo

Prerequisites:

Then install the CLI:

$ cargo install lutra-cli

Note

The CLI depends on DuckDB. On Debian or Ubuntu, you can install it with apt install libduckdb-dev. On macOS, you can use brew install duckdb.

Optional: you can also use --features bundled to compile DuckDB from source. This requires a C++ compiler.

Run your first program

Create a file named example.lt:

example.lt
func main() -> "Hello, world!"

Run it on DuckDB:

$ lutra run --project example.lt --runner duckdb
const output = "Hello, world!"

This is the fastest way to try out small language examples from the learning guides.

If you want omit the --runner argument, you can set the default runner in the .lt file.

example.lt
@!runner("duckdb")
func main() -> "Hello, world!"

Check a project

Use check to validate a project without running it.

$ lutra check --project example.lt
All good.

This is useful when you want type checking and diagnostics while editing code.

Run an expression directly

You can also run a one-off expression without creating a project function.

$ lutra run \
    --runner duckdb \
    --program 'fold([1, 2, 3], 0: Int32, func (s, v) -> s + v)'
6

This is handy for quick experiments.

Explore a project interactively

Use interactive when you want a live project environment with recompilation.

$ lutra interactive --project example.lt

You can also use other runners:

$ lutra interactive --project project.lt --runner postgres://user:pass@localhost:5432/db
$ lutra interactive --project project.lt --runner duckdb:data.duckdb

interactive is a good fit for exploration, rapid iteration, and trying transformations against a real backend.

See also