mirror of
https://github.com/numtide/treefmt.git
synced 2024-08-17 04:40:27 +03:00
For each path we determine the list of formatters that are interested in formatting it. From there, we sort the list of formatters first by priority (lower value, higher priority) and then by name (lexicographically). With this information we create a batch key which is based on the unique sequence of formatters. When enough paths with the same sequence is ready we apply them in order to each formatter. By default, with no special configuration, this model guarantees that a given path will only be processed by one formatter at a time. If a user wishes to influence the order in which formatters are applied they can use the priority field. Signed-off-by: Brian McGee <brian@bmcgee.ie>
15 lines
574 B
Go
15 lines
574 B
Go
package config
|
|
|
|
type Formatter struct {
|
|
// Command is the command to invoke when applying this Formatter.
|
|
Command string
|
|
// Options are an optional list of args to be passed to Command.
|
|
Options []string
|
|
// Includes is a list of glob patterns used to determine whether this Formatter should be applied against a path.
|
|
Includes []string
|
|
// Excludes is an optional list of glob patterns used to exclude certain files from this Formatter.
|
|
Excludes []string
|
|
// Indicates the order of precedence when executing this Formatter in a sequence of Formatters.
|
|
Priority int
|
|
}
|