Tools
The fb command
fb builds, runs, tests, formats, and documents FutureBlitz programs, and manages their packages.
fb is FutureBlitz’s one command. It compiles programs, runs them and their tests, formats and
documents their code, turns C headers into modules, and adds, updates, and publishes packages.
fb [--color <when>] <command> [options] [<file or folder>]Commands
| Command | What it does |
|---|---|
fb new | Makes a package in a new folder |
fb check | Checks a program for errors, without building it |
fb build | Compiles a program into an executable |
fb run | Compiles a program and runs it |
fb test | Compiles a package’s tests and runs them |
fb fmt | Formats .fb files in place |
fb doc | Writes a package’s public API as JSON, with its docs |
fb bindgen | Turns a C header into a FutureBlitz module |
fb add | Adds dependencies from a registry to project.toml |
fb update | Updates fb.lock’s versions to the newest the ranges allow |
fb search | Searches a registry’s packages |
fb publish | Publishes a package to a registry |
fb yank | Yanks a published version, so new builds don’t pick it |
fb owner | Lists, adds, or removes a package’s owners |
fb login | Signs in to a registry, and keeps its token |
fb logout | Forgets a registry’s token |
fb help <command> and fb <command> --help show a command’s options.
What a command works on
The commands that build take a .fb file, a package’s folder, or nothing. With nothing, they
work on the package the current folder is in: the nearest folder, from the current one up, that
has a project.toml.
- A package is a folder with a project.toml. Its
.fbfiles, in the folder and the folders under it, are its modules, and its main file,main.fbunless project.toml names another, is where its program starts. - A file outside a package is a program of its own, with the files it imports.
Options for every command
| Option | |
|---|---|
--color <when> | Colors the output: auto, always, or never. auto colors it in a terminal, unless NO_COLOR is set. |
-h, --help | Shows the command’s help |
--version | Shows fb’s version, the commit it was built from, and its target, like fb 1.0.0 (<commit>, <target>) |
Exit codes
| Code | |
|---|---|
| 0 | The command did what it was asked |
| 1 | The code has errors, a build or a test failed, or fb itself failed |
| 2 | The command line was wrong, or a source file couldn’t be read |
fb run exits with the program’s own code, and a program that
panics exits with 101.
Output
fb writes what it’s doing, and every error and warning, to stderr, so a program’s own output on stdout stays apart. An error names its file, line, and column, shows the line, and points at the place:
main.fb:2:16: error: expected Int32, found String
|
2 | Local x: Int = "a"
| ^^^Environment variables change some of this, like the columns errors count in.
Report an issue with this page or with FutureBlitz on GitHub.