Skip to content

The ligare command

The compiler can process source files directly or operate on a package described by ligare.toml.

text
Usage: ligare [OPTIONS] [FILE]... [COMMAND]

Run ligare help COMMAND for the complete options of a subcommand.

Direct source processing

Pass one or more .lig files to check and evaluate them:

bash
ligare path/to/program.lig
ligare path/to/program.lig --eval "1 + 2"

Use --emit-source to print the selected backend's source instead of running the evaluator. --emit-c is a visible alias:

bash
ligare --emit-source path/to/program.lig
ligare --emit-c path/to/program.lig

-o, --output PATH compiles the generated C into a native executable. The current registry contains only the c backend; --backend c is therefore the default.

Package commands

All package commands accept a project directory or --manifest-path PATH/to/ligare.toml.

CommandPurpose
new PATHCreate a new binary package. Use --lib for a library package.
init [PATH]Initialize an existing directory as a package.
build [PATH]Check and compile the package.
run [PATH]Build and run a binary package. Arguments after -- go to the executable.
check [PATH]Check the package without backend output.
update [NAME] [VERSION]Resolve dependencies and refresh ligare.lock.
test [PATH]Check every file whose name ends in _test.lig.
clean [PATH]Remove the package's target directory.

Examples:

bash
ligare new hello
ligare check --manifest-path hello/ligare.toml
ligare build --manifest-path hello/ligare.toml
ligare run --manifest-path hello/ligare.toml -- --verbose
ligare test --manifest-path hello/ligare.toml
ligare clean --manifest-path hello/ligare.toml

build defaults to target/debug. Add --release for target/release, or use -O 0, -O 1, -O 2, -O 3, -O s, or -O z to select the native optimization level.

Source tools

bash
ligare fmt .
ligare fmt --check .
ligare doc src
ligare doc src -o docs/api.md

fmt --check reports whether formatting changes are needed without writing files. doc emits Markdown and omits private definitions unless --private is supplied.