Move all config related code into a config package.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #25
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Fixes a bug with formatters processing paths out of order.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #24
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Allows specifying the order in which formatters are applied.
Very simple for now, adding a `Before` field to the formatted config which allows the user to say that formatter `x` needs to be applied _before_ formatted `y`.
```toml
[formatter.statix]
command = "statix"
includes = ["*.nix"]
before = "deadnix"
[formatter.deadnix]
command = "statix"
includes = ["*.nix"]
```
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #20
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Introduces a `--walk` flag which can be used to tell `treefmt` how to traverse the directory specified by `--tree-root`.
By default, it will attempt to use `git ls-files`. If this fails, it falls back to using the filesystem.
You can explicitly traverse the filesystem instead of using git by providing `--walk filesystem`.
Close#1
Reviewed-on: #19
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Closes#10
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #15
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Closes#8
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #16
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Since we discussed this in #14 (comment)
It doesn't really matter.
Reviewed-on: #17
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>
Tracks the mod time and size of a formatter's executable in bolt.
The cache is busted using the following criteria:
- a new formatter has been configured.
- an existing formatter has changed (mod time or size)
- an existing formatter has been removed from config
Also implemented better resolution of symlinks when determining a formatters executable path.
Reviewed-on: #14
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Stacked on top of #11
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #13
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>
The package was created before Go introduced their own "errors"
package.
Trade the better juju errors semantic for a smaller dependency tree.
Reviewed-on: #11
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>