Skip to content

Commit 6070b6f

Browse files
committed
doc: refine faq
Signed-off-by: Brian McGee <[email protected]>
1 parent 4d60509 commit 6070b6f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

docs/faq.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22

33
## How does treefmt function?
44

5-
`Treefmt` traverses all your project's folders, maps files to specific code formatters, and formats the code accordingly. Other tools also traverse the filesystem, but not necessarily starting from the root of the project.
5+
`Treefmt` traverses all your project's folders, maps files to specific code formatters, and formats the code
6+
accordingly. Other tools also traverse the filesystem, but not necessarily starting from the root of the project.
67

7-
Contrary to other formatters, `treefmt` doesn't preview the changes before writing them to a file. If you want to view the changes, you can always check the diff in your version control (we assume that your project is checked into a version control system). You can also rely on version control if errors were introduced into your code as a result of disruptions in the formatter's work.
8+
Contrary to other formatters, `treefmt` doesn't preview the changes before writing them to a file. If you want to view
9+
the changes, you can always check the diff in your version control (we assume that your project is checked into a
10+
version control system).
11+
12+
You can also rely on version control if errors were introduced into your code as a result of disruptions in the
13+
formatter's work.
814

915
## How is the cache organized?
1016

11-
At this moment, the cache is represented by a flat TOML file where file paths are mapped to `mtimes`. The file is located in:
17+
At the moment, the cache is a [BoltDB] database file in which file paths are mapped to `mtimes`.
18+
19+
The file is located in:
1220

1321
```
14-
~/.cache/treefmt/<hash-of-the-treefmt.toml-path>.toml
22+
~/.cache/treefmt/eval-cache/<hash-of-the-treefmt.toml-path>.db
1523
```
1624

17-
However, we are planning to move the hash file to the destination project's root directory.
25+
At the end of each run, the database is updated with the last formatting time entries. In this way, we can
26+
compare the last change time of the file to the last formatting time, and figure out which files need re-formatting.
1827

19-
At the end of each tool run, the cache file gets overwritten with the last formatting time entries. In this way, we can can compare the last change time of the file to the last formatting time, and figure out which files need re-formatting.
28+
[BoltDB]: https://github.com/etcd-io/bbolt

0 commit comments

Comments
 (0)