CLI
The `bao` CLI is Baobab's command-line tool. It uses the exact same engine as the online IDE, so your programs run identically locally and in the browser. This page walks through every command, its options and its output — no prior experience required.
Install & check
The online IDE needs no install. A one-line installer (get.baobablang.dev) is on the way; meanwhile the `bao` CLI ships with the open-source toolchain (Python 3.13+).
# À venir — installeur en une ligne (macOS / Linux) :
# curl -fsSL get.baobablang.dev | sh
bao --version # → bao 0.1.0
bao --help # liste toutes les commandes| -h, --help | Show help (global or per-command) and exit. E.g. `bao run --help`. |
| --version | Show the Baobab version and exit. |
Commands
bao runRuns a `.bao` (or `.py`) file. It automatically follows local imports (`importer … depuis "./x.bao"`), checks the syntax before running, prints the program's output, and returns the program's exit code. On error, the traceback is shown with French names (`ErreurValeur`, `ErreurCle`…) and points at your `.bao` file.
| --seed N | Seed the random module (`aleatoire`) for reproducible runs. |
| --timeout S | Maximum execution time in seconds (default: 5). |
bao run main.baoRun the program.bao run jeu.bao --seed 42Deterministic randomness.bao translateConverts code both ways while preserving indentation, comments and blank lines. The direction is inferred from the extension (`.bao` → Python, `.py` → Baobab) or forced with `--to`. With no output option the result is printed to standard output; `-o` writes to the given file, `-w` writes next to the source.
| --to python|bao | Target language (default: inferred from the extension). |
| -o, --output <file> | Write the result to this file. |
| -w, --write | Write next to the source, swapping the extension. |
bao translate main.bao --to pythonPrint the Python translation.bao translate app.py -wCreate app.bao next to app.py.bao buildWalks a directory (or a file) and transpiles every `.bao` to `.py` into an output directory (default: `build/`), preserving the subfolder structure. Each file's syntax is checked; on error it is reported and that file is skipped.
| <path> | File or directory to build (default: current directory). |
| -o, --output <dir> | Output directory (default: build). |
bao build src -o distTranspile src/ into dist/.bao testDiscovers and runs every file named `test_*.bao` or `*_test.bao` under the given directory. A test passes if its program exits with code 0 (use `affirmer` to check your assumptions). A `N passed, M failed` summary is printed; the command returns a non-zero code if any test fails.
| <path> | Directory to scan (default: current directory). |
bao test testsRun every test under tests/.bao formatTidies the layout: converts tabs to 4 spaces, strips trailing whitespace and ensures a single final newline. Accepts files and directories (recursive over `.bao`). Changed files are listed.
| <path>... | One or more files or directories to format. |
bao format srcFormat every .bao in src/.bao installWill install packages from the future Baobab community registry. This command is not available yet: the package manager and registry are planned for a later phase. For now it prints a message and exits without installing anything.
bao install math-frSoon: install the math-fr package.Exit codes
Every command returns an exit code you can check in scripts and CI.
| 0 | Success (or the run program's own exit code). |
| 1 | Syntax error, runtime error, or failing tests. |
| 2 | Misuse: file not found, invalid argument, unavailable command. |
| 124 | Execution timed out (see --timeout). |