goldsmith/extension.go

31 lines
902 B
Go
Raw Normal View History

2018-12-08 19:18:51 +00:00
package goldsmith
2019-04-07 20:43:25 +00:00
// Plugin contains the minimum set of methods required on plugins. Plugins can
// also optionally implement Initializer, Processor, and Finalizer interfaces.
type Plugin interface {
Name() string
}
// Initializer is used to optionally initialize a plugin and to specify a
// filter to be used for determining which files will be processed.
2018-12-08 19:18:51 +00:00
type Initializer interface {
2024-03-03 19:14:50 +00:00
Initialize(context Context) error
2018-12-08 19:18:51 +00:00
}
2019-04-07 20:43:25 +00:00
// Processor allows for optional processing of files passing through a plugin.
2018-12-08 19:18:51 +00:00
type Processor interface {
2024-03-03 19:14:50 +00:00
Process(context Context, file File) error
2018-12-08 19:18:51 +00:00
}
2019-04-07 20:43:25 +00:00
// Finalizer allows for optional finalization of a plugin after all files
// queued in the chain have passed through it.
2018-12-08 19:18:51 +00:00
type Finalizer interface {
2024-03-03 19:14:50 +00:00
Finalize(context Context) error
2018-12-08 19:18:51 +00:00
}
2019-04-07 20:43:25 +00:00
// Filter is used to determine which files should continue in the chain.
2018-12-08 19:18:51 +00:00
type Filter interface {
2019-04-07 20:43:25 +00:00
Name() string
2024-02-20 00:26:41 +00:00
Accept(file File) bool
}