There are two options to install treefmt: by downloading the latest binary, or by compiling and building the tool from source.

Installing with a binary file

You can find the list of the latest binaries

Building from source

There are several ways to build treefmt from source. Your choice will depend on whether you’re a

Non-Nix User

To try the project without building it, run:
$ cargo run -- --help
The command will output the manual. You can run the tool in this manner with any other flag or option to format your project.
To build a binary, you need to have rust installed. You can install it with . Now, if you want to build the project, switch to the project root folder and run:
$ cargo build
After the successful execution of the cargo build command, you will find the treefmt binary in the target folder.

Nix User

is a package manager foundational for NixOS. You can use it in NixOS and in any other OS equally.

Here you also have two options: you can install treefmt with plain nix-build , or with nix-shell.
To build the package with nix-build, just run:
$ nix-build -A treefmt
To build the project with nix-shell, make sure it’s installed, and run this command inside it:
$ ?????

If you want to use this repository with flakes, please enable the flakes feature first. To run the project with flakes without building it, you can execute the following command in the root folder:
$ nix run . -- --help
To build the project, run the following command in the root folder:
$ nix build
The treefmt binary will be available in the result folder.

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