This repository has been archived on 2024-05-03. You can view files and clone it, but cannot push or open issues or pull requests.
treefmt/internal/format/config.go

19 lines
530 B
Go
Raw Normal View History

2023-12-23 12:50:47 +00:00
package format
import "github.com/BurntSushi/toml"
2023-12-24 11:59:05 +00:00
// Config is used to represent the list of configured Formatters.
2023-12-23 12:50:47 +00:00
type Config struct {
Global struct {
// Excludes is an optional list of glob patterns used to exclude certain files from all formatters.
Excludes []string
}
Formatters map[string]*FormatterConfig `toml:"formatter"`
2023-12-23 12:50:47 +00:00
}
2023-12-24 11:59:05 +00:00
// ReadConfigFile reads from path and unmarshals toml into a Config instance.
2023-12-23 12:50:47 +00:00
func ReadConfigFile(path string) (cfg *Config, err error) {
_, err = toml.DecodeFile(path, &cfg)
return
}