Skip to content
FutureBlitz

    Install

    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

    CommandWhat it does
    fb newMakes a package in a new folder
    fb checkChecks a program for errors, without building it
    fb buildCompiles a program into an executable
    fb runCompiles a program and runs it
    fb testCompiles a package’s tests and runs them
    fb fmtFormats .fb files in place
    fb docWrites a package’s public API as JSON, with its docs
    fb bindgenTurns a C header into a FutureBlitz module
    fb addAdds dependencies from a registry to project.toml
    fb updateUpdates fb.lock’s versions to the newest the ranges allow
    fb searchSearches a registry’s packages
    fb publishPublishes a package to a registry
    fb yankYanks a published version, so new builds don’t pick it
    fb ownerLists, adds, or removes a package’s owners
    fb loginSigns in to a registry, and keeps its token
    fb logoutForgets 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 .fb files, in the folder and the folders under it, are its modules, and its main file, main.fb unless 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, --helpShows the command’s help
    --versionShows fb’s version, the commit it was built from, and its target, like fb 1.0.0 (<commit>, <target>)

    Exit codes

    Code
    0The command did what it was asked
    1The code has errors, a build or a test failed, or fb itself failed
    2The 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.