# treefmt

**The formatter multiplexer**
_A
numtide project._
`treefmt` streamlines the process of applying formatters to your project, making it a breeze with just one command line.
## Motivation
Modern code repositories are rarely written in a single language. They often contain a mix of languages, each with its own formatting requirements.
While working for our customers, we noticed that projects each tended to re-implement the same formatter multiplexing logic. A script that invokes all the formatters.
What if that script was a single command?
What if that single command would handle all the formatters in parallel? And only format files that have changed since the previous run?
That's what treefmt is about.
## About treefmt
`treefmt` runs all your formatters with one command. It’s easy to configure and fast to execute.

Its main features are:
- **Providing a unified CLI and output**
- You don’t need to remember which formatters are necessary for each project.
- Once you specify the formatters in the config file, you can trigger all of them with one command and get a
standardized output.
- **Running all the formatters in parallel**
- A standard script loops over your folders and runs each formatter sequentially.
- In contrast, `treefmt` runs formatters in parallel. This way, the formatting job takes less time.
- **Tracking file changes**
- When formatters are run in a script, they process all the files they encounter, regardless of whether or not
they have changed.
- `treefmt` tracks file changes, and only attempts to format files which have changed.
To reformat the whole source tree, just type `treefmt` in any folder. This is a fast and simple formatting solution.
## Installation
You can install `treefmt` by downloading the binary. Find the binaries for different architectures [here](https://github.com/numtide/treefmt/releases).
Otherwise, you can install the package from source code — either with [Go], or with the help of [nix].
We describe the installation process in detail in the [docs].
## Usage
In order to use `treefmt` in your project, make sure the config file `treefmt.toml` is present in the root folder and
is edited to suit your needs.
You can generate it with:
```
$ treefmt --init
```
You can then run `treefmt` in your project root folder like this:
```
$ treefmt
```
To explore the tool’s flags and options, type:
```console
$ treefmt --help
```
Additionally, there's a wrapper called [`treefmt-nix`](https://github.com/numtide/treefmt-nix) for using `treefmt` with [`nix`](https://github.com/NixOS/nix).
## Configuration
Formatters are specified in the config file `treefmt.toml`, which is usually located in the project root folder. The
generic way to specify a formatter is like this:
```
[formatter.