CLI Reference

Every command and flag for the loon binary.

loon run

The most common command. Give it a file and it runs your program. Pass --watch during development and it will re-run automatically every time you save, which makes for a tight feedback loop.

SHELL
loon run  [args...]

--watch

Re-run automatically when the source file changes.

--quiet

Suppress non-error output.

--time

Print execution time after the program finishes.

loon build

Compile a Loon project to a standalone executable. The --release flag enables optimizations, so you will want it for anything you ship.

SHELL
loon build  [--output ]

--output, -o

Set the output file path.

--release

Build with optimizations enabled.

loon test

Discovers and runs all test blocks in a file or directory. If you pass a directory, Loon will recursively find every .loon file and run the tests inside it.

SHELL
loon test [path]

--filter

Only run tests whose name matches the pattern.

--verbose

Print each test name as it runs.

loon check

Type-check your code without actually running it. This is faster than loon run and useful in CI or when you just want to make sure your types line up. Exits with code 0 if everything is clean, 1 if there are errors.

SHELL
loon check 

--watch

Re-check on file changes.

loon repl

Start an interactive session where you can evaluate expressions one at a time. Great for exploring the language, testing ideas, or debugging. Use Ctrl-D or :quit to exit.

SHELL
loon repl

loon fmt

Automatically format your Loon source files. By default it writes changes back to the files. The --check flag instead reports whether any files would change, which is what you want in CI.

SHELL
loon fmt [files...]

--check

Exit with code 1 if any file is not formatted. Does not modify files.

--write

Write formatted output back to the source files (default).

loon explain

If you get a cryptic error code, this command will give you a detailed explanation of what it means and how to fix it.

SHELL
loon explain 

Example: loon explain E0012

loon new

Scaffold a new project. This creates a directory with a main.loon file and a basic project structure so you can start writing code immediately.

SHELL
loon new 

loon lsp

Start the Loon language server over stdin/stdout. You should not need to run this yourself; your editor calls it automatically. See the Language Server reference for setup instructions.

SHELL
loon lsp