1
Fork 0
goldsmith/extension.go

33 lines
913 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.
2024-03-04 05:39:08 +00:00
type (
Plugin interface {
Name() string
}
2019-04-07 20:43:25 +00:00
2024-03-04 05:39:08 +00:00
// Initializer is used to optionally initialize a plugin and to specify a
// filter to be used for determining which files will be processed.
Initializer interface {
Initialize(context *Context) error
}
2018-12-08 19:18:51 +00:00
2024-03-04 05:39:08 +00:00
// Processor allows for optional processing of files passing through a plugin.
Processor interface {
Process(context *Context, file *File) error
}
2018-12-08 19:18:51 +00:00
2024-03-04 05:39:08 +00:00
// Finalizer allows for optional finalization of a plugin after all files
// queued in the chain have passed through it.
Finalizer interface {
Finalize(context *Context) error
}
2018-12-08 19:18:51 +00:00
2024-03-04 05:39:08 +00:00
// Filter is used to determine which files should continue in the chain.
Filter interface {
Name() string
Accept(file *File) bool
}
)