Skip to content

Commit

Permalink
add PrependPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Code-Hex authored Jan 24, 2022
1 parent fcee4c4 commit b91d720
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ func AddPlugin(p plugin.Plugin) Option {
}
}

// PrependPlugin prepends plugin any existing plugins
func PrependPlugin(p plugin.Plugin) Option {
return func(cfg *config.Config, plugins *[]plugin.Plugin) {
*plugins = append([]plugin.Plugin{p}, *plugins...)
}
}

// ReplacePlugin replaces any existing plugin with a matching plugin name
func ReplacePlugin(p plugin.Plugin) Option {
return func(cfg *config.Config, plugins *[]plugin.Plugin) {
Expand Down

0 comments on commit b91d720

Please sign in to comment.