CLI reference
The legion command is the entry point for everything: running files, the REPL, static checking, formatting, project scaffolding, and the package manager.
legion run
Runs a .lhj file.
bash
legion run hello.lhj
legion run ./src/main.lhj
legion run --debug app.lhj ## extra debug outputlegion repl
Opens the interactive REPL.
bash
legion replInside the REPL, type :help for a list of REPL-specific commands.
legion check
Runs a static analysis pass over a file. Reports type mismatches, undefined variables, and other issues without running the program.
bash
legion check app.lhj
legion check src/legion fmt
Formats a .lhj file in place according to the standard style (2-space indent, spaces around operators, newline at EOF).
bash
legion fmt app.lhj ## format single file
legion fmt --dry-run app.lhj ## show diff without writing
legion fmt src/ ## format all .lhj files in directorylegion new
Scaffolds a new project directory.
bash
legion new my-projectCreates:
lhj
my-project/
main.lhj
legion.pkg
legion.lock
README.mdlegion pkg
Package manager subcommand. See Package manager for the full reference.
bash
legion pkg install legion-colors
legion pkg remove legion-colors
legion pkg list
legion pkg search http
legion pkg init
legion pkg publishlegion version
Prints version information.
bash
legion versionlhj
legionhjyu 1.0.0
Python 3.12.0legion help
Prints help for any command.
bash
legion help
legion help run
legion help pkgExit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Runtime error in the script |
2 | CLI usage error (bad arguments) |
3 | File not found |