From 6070b6f6e4fb162d0602d46083cb97701fed424f Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Wed, 1 May 2024 14:10:45 +0100 Subject: [PATCH] doc: refine faq Signed-off-by: Brian McGee --- docs/faq.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 927d995..54c09ae 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -2,18 +2,27 @@ ## How does treefmt function? -`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. +`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. -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. +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. ## How is the cache organized? -At this moment, the cache is represented by a flat TOML file where file paths are mapped to `mtimes`. The file is located in: +At the moment, the cache is a [BoltDB] database file in which file paths are mapped to `mtimes`. + +The file is located in: ``` -~/.cache/treefmt/.toml +~/.cache/treefmt/eval-cache/.db ``` -However, we are planning to move the hash file to the destination project's root directory. +At the end of each run, the database is updated with the last formatting time entries. In this way, we can +compare the last change time of the file to the last formatting time, and figure out which files need re-formatting. -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. +[BoltDB]: https://github.com/etcd-io/bbolt \ No newline at end of file