You can run treefmt by executing:
$ treefmt
or, if it’s not in your PATH:
$ ./treefmt
Treefmt has the following specification:
treefmt [FLAGS] [OPTIONS] [--] [paths]...



Do not exit with an error if some of the configured formatters are missing.
Reset the evaluation cache. Invalidation should happen automatically if the formatting tool has been updated, or if the files to format have changed. If cache wasn’t properly invalidated, you can use this flag to clear the cache.
Exit with error if some files require re-formatting. This is useful for your CI if you want to detect if the contributed code was forgotten to be formatted.
-h, --help
Prints available flags and options
Creates a new config file treefmt.toml.
Tells treefmt to ignore the evaluation cache entirely. With this flag, you can avoid cache invalidation issues, if any.
-q, --quiet
Don’t print output to stderr.
Format the content passed in stdin.
-V, --version
Print version information.
-v, --verbose
Change the log verbosity. Log verbosity is based off the number of ‘v’ used. With one ‘v’, your logs will display [[INFO]] and [[ERROR]] messages, while -vv will also show [[DEBUG]] messages.
--config-file <config-file>
Run with the specified config file which is not in the project tree.
-f, --formatters <formatters>...
Only apply selected formatters. Defaults to all formatters.
--tree-root <tree-root>
Set the path to the tree root directory. Defaults to the folder holding the treefmt.toml file [env: PRJ_ROOT=]
-C <work-dir>
Run as if treefmt was started in <work-dir> instead of the current working directory [default: .]


Paths to format. Defaults to formatting the whole tree

CI integration

You can you set a treefmt job in the GitHub pipeline for Ubuntu with nix-shell like this:
name: treefmt
branches: master
runs-on: ubuntu-latest
- uses: actions/checkout@v1
- uses: cachix/install-nix-action@v12
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10
name: nix-community
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: treefmt
run: nix-shell --run "treefmt --fail-on-change --no-cache"

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.